Original date:2018-12-17 09:35:35 Edited by: irv Subject: Re: Call to c_func() short-circuited

As Chris said, perhaps you are making the task a lot harder than necessary. Is there a reason one of Euphoria's file functions wouldn't do the same job?

If you must call a C routine:

First of all, which .dll or .so contains the C code you wish to call? Are you loading that with open_dll()?

(1) example:

atom LIB = open_dll("")
  -- or LIB = open_dll("xxx.dll") on Windows 
? LIB -- if this prints a -1, the library is invalid or can't be found 

Secondly, has Read_File_id been defined?

(2) example:

atom Read_File_id = define_c_func(LIB,"name_of_the_c_function",{PARAMS},RETURN TYPE)
? Read_File_id -- should be a large integer, not 0  

Just guessing from the names of the parameters, it appears that your C function is expecting the first parameter lpBuffer to be a pointer to buffer space you have allocated, which the C function will fill with data read, and the 3rd parameter lpNumberOfBytesRead to be allocated space where the C routine expects to store the result so that you can check it later. Possibly the return type would be a boolean to indicate success or failure?

Without further info, it would be hard to guess if this is correct or to guide you on how to allocate those spaces.

Not Categorized, Please Help


Quick Links

User menu

Not signed in.

Misc Menu