amoeba icon indicating copy to clipboard operation
amoeba copied to clipboard

How do I create a DLL for this library?

Open JBetz opened this issue 2 years ago • 4 comments

I'd like to use amoeba as an external library in Smalltalk but don't know how to generate a DLL from the header file.

Is there a one line script for doing so with gcc or other C compiler?

JBetz avatar Sep 25 '22 12:09 JBetz

Got it: gcc -shared -O2 -DAM_IMPLEMENTATION -xc ameoba.h -o ameoba.dll

JBetz avatar Sep 26 '22 06:09 JBetz

The DLL loads fine, but the example fails with an invalid memory access error in am_setrelation(c1, AM_EQUAL). It seems to be happening inside the call to am_multiply https://github.com/starwing/amoeba/blob/master/amoeba.h#L594 since it gets further if I change the relation to AM_GREATEQUAL.

Are there any other flags that need to be set for 32-bit builds? I did try again with -DAM_USE_FLOAT but that didn't seem to make a difference.

JBetz avatar Sep 26 '22 07:09 JBetz

Which system your on? maybe I could try it out. It works well on my Mac.

starwing avatar Oct 01 '22 14:10 starwing

I have tried the DLL build on Windows. Could you give me a segfaul example? the test.Lua seems work.

gcc -o amoeba.dll -mdll -DLUA_BUILD_AS_DLL .\lua_amoeba.c -LC:\Devel\Lua54\lib
 -llua54

starwing avatar Oct 01 '22 14:10 starwing