Re: Basic Statistics with OpenEuphoria
- Posted by Icy_Viking May 21, 2020
- 3321 views
rneu said...
Thanks for very useful suggestions.
This link is not working: https://openeuphoria.org/wiki/view/std_dll.html#_5377_dynamiclinkingtoexternalcode.wc
The easiest way to wrap a C library in Euphoria is to use a DLL.
--load sigil.dll atom sl --do platform check and load library for the correct platform ifdef WIN32 then sl = open_dll("sigil.dll") if sl = -1 then puts(1,"Failed to open sigil.dll!\n") abort(0) end if elsifdef LINUX or FREEBSD then sl = open_dll("sigil.so") if sl = -1 then puts(1,"Failed to load sigil.so!\n") abort(0) end if end ifdef public constant xslWindow = define_c_proc(sl,"+slWindow",{C_INT,C_INT,C_POINTER,C_INT}) public procedure slWindow(atom width,atom height,sequence title,integer fullScr) atom str = allocate_string(title,1) c_proc(xslWindow,{width,height,str,fullScr}) end procedure
The above is a snippet from a wrapper I wrote for the Sigil library. The process is virtually the same for most C libraries you would want to wrap.