Re: MGRX Graphics Library
- Posted by ghaberek (admin) May 14, 2021
- 914 views
Icy_Viking said...
Making a DLL out of the existing C code shouldn't be too difficult, might be tedious, but should be possible. Then a wrapper for Euphoria/Phix could be made.
I found this in the readme:
- For linux framebuffer and X11 select shared or static libraries. By default only the static libraries are build (and it is the recomended option). To build the shared libraries set INCLUDE_SHARED_SUPPORT=y
So at least on Linux you should be able to build a shared library (this ends up in lib/unix/libmgrxX.so.1).
sudo apt install libjpeg-dev libpng-dev zlib1g-dev tar xzf mgrx134.tar.gz && cd mgrx134 make -f makefile.x11 INCLUDE_SHARED_SUPPORT=y
Still not sure what to do for Windows since there's no shared library option in makefile.w32.
You might be able to just bind the static library into a DLL like this, but I haven't tried it yet.
mingw32-make -f makefile.w32 gcc -shared -o lib/win32/libmgrx.dll -Wl,--whole-archive lib/win32/libmgrx.a -Wl,--no-whole-archive -ljpeg -lpng -lz
If you get "PIC" errors then you might need to rebuild with "CCOPT=-fPIC -D__SHARED__" added to that make command.
-Greg