Linux port for dll calls

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

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

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

Search



Quick Links

User menu

Not signed in.

Misc Menu