Re: Bad Routine Number
- Posted by ghaberek (admin) Jun 01, 2019
- 1519 views
So I recently went to check my SDL wrapper while using the new Euphoria 4.1.0 Beta 2 and noticed that I get a bad routine number -1 when trying to run a example program. This did not happen using 4.0.5.
Since 4.1 is both 32-bit and 64-bit, make sure you're not mixing versions of DLLs. 32-bit applications can only load 32-bit DLLs and vice-versa. Chances are you've got 64-bit Euphoria and 32-bit library, or again, vice-versa.
An atom, actually a 32-bit address. 0 is returned if the .dll can't be found.
To elaborate, open_dll() is supposed to return an in-memory address to the library that it's opened, so it returns NULL (0) if the library cannot be found. Conversely, define_c_func/proc() return an ordinal number of the routine as it's stored in the table of known routines, so it returns -1 if the routine cannot be found in the library. Finally define_c_var() also expects to return an in-memory address of the variable it found in the library, but for some reason it will return -1 and not NULL if the variable cannot be found. A lot of this is a side effect of the backend internals (see be_machine.c).
-Greg