Jump to content
Excelsior Forums
Sign in to follow this  
sboone

Function call problem

Recommended Posts

I'm using xFunction to make calls to a DocketPort685 scanner dll.  I keep getting a 'Bad Parameter' return value from the function call.  I have included some of the code below;  can you see anything obviously wrong that I'm doing?  By the way,  I have the dll and header files for the scanner dll.

/* From header files */

typedef unsigned char uint8;

typedef unsigned short uint16;

typedef unsigned long uint32;

#if !defined(SICALLTYPE)

#define SICALLTYPE

#endif

#if !defined(SYSCANDLL_API)

#define SYSCANDLL_API

#endif

typedef uint32 SIResult;

SYSCANDLL_API SIResult SICALLTYPE  SI_ReadImageData(uint8 *buffer, uint32 numberOfLinesToRead, uint32 pageNumber, uint32* numberOfLinesReturned );

/* From my code */

long retlines = 0;

long numlinestoscan = 100;

long scanthefront = 0;

                         

Pointer pretlines = Pointer.createPointerTo(retlines);

char[] buffer = new char[48000];

                         

xFunction c = new xFunction(dllName, "long SI_ReadImageData(char*,long,long,long*)");

Pointer pbuffer = (Pointer)Argument.create("char*", buffer);

                         

Long r = (Long)c.invoke(pbuffer, new Argument(numlinestoscan), new Argument(scanthefront), pretlines);

/* r is always 14 (Bad Parameter) but it does not specify which parameter */

Thanks,

S. Boone

Share this post


Link to post
Share on other sites

Sorry, found two errors in post; should include following:

#if !defined(SICALLTYPE)

#define SICALLTYPE __cdecl

#endif

#if !defined(SYSCANDLL_API)

// On Windows/Intel platform, the following ifdef block creates macros which

// simplify exporting from this DLL.

#ifdef SYSCANDLL_EXPORTS

#define SYSCANDLL_API __declspec(dllexport)

#else

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×