Linux port for dll calls
- Posted by George Orr <georgeorr at donet.com> Feb 02, 2002
- 454 views
I am trying to port Euphoria code from Windows to Linux. The windows project built a dynamic link library and then called a function from this library. I would like to do the same in Linux, but am having trouble with the details! In windows, I used the Borland compiler and a function declaration void __stdcall __declspec(dllexport) encipher(ULONG v[2],ULONG w[2],ULONG k[4]); to create a dynamic link library, xtea.dll. I used a Euphoria wrapper including the following to access this function: include dll.e constant dll_xtea = open_dll("xtea.dll") constant encipher_ = define_c_proc( dll_xtea, "encipher", {C_POINTER,C_POINTER,C_POINTER}) global procedure encipher(atom v, atom w, atom k) c_proc(encipher_, {v,w,k}) end procedure When I try to compile the c code that works for the Borland compiler using gcc, I get errors indicating that __stdcall and __declspec(dllexport) are not recognized. When I remove these and compile (using gcc -shared -o tea.so tea.c) the compile works, but then the wrapper function does not, returning a message indicating that "encipher" cannot be found in the shared library. Can anyone provide examples of c code that can be compiled using gcc into a shared library and examples of the associated wrapper for Euphoria? This is probably simple if you know how to do it! Thanks. George