Re: Call to c_func() short-circuited

new topic     » goto parent     » topic index » view thread      » older message » newer message

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("xxx.so")
  -- 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 an 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.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu