logo       

Re: swi-prolog and mingw32: msg#01538

Subject: Re: swi-prolog and mingw32
Steve Moyle wrote:

> 1. Installed mingw packages on the linux box:
> mingw32-runtime-3.7-2
> binutils-mingw32-2.15.94-1
> gcc-mingw32-3.4.2-4
> mingw32-w32api-3.2-2

This is the unix port I have installed on FreeBSD and is the tool-set I would like to use for win32 cross-compiled apps.

> 2. Sample Makefile
> The simple Makefile below, allowed the same C source for a foreign module
> for SWI-Prolog to be built for either linux or win32.
> (Note that libpl.lib was copied from the Win32 distribution of SWI-Prolog,
> whilst the Linux system had its own distribution of SWI-Prolog)
> PLBASE=$(shell eval `pl -dump-runtime-variables` && echo $$PLBASE)
> MINGW=i386-mingw32
> WINLIBPL=build_scripts/materials/libpl.lib
> all: so dll
> so: bin/my_shared_object.so
> dll: bin/my_shared_object.dll
> bin/my_shared_object.so: my_shared_object.c
> plld -o bin/sql_tokens -shared -Wall -O3 -g sql_tokens.c
> bin/my_shared_object.dll: my_shared_object.c
> $(MINGW)-gcc -I$(PLBASE)/include -O3 -shared -o $@ $< $(WINLIBPL)
> $(MINGW)-strip bin/sql_tokens.dll

The process here is to build a shared object for two platforms that contains foreign-functions callable from swi-pl on win32 and unix.

I may be missing something fundamental but what I am really trying to do is embed swi-pl in a win32 app and a unix app but from a unix environment. So the makefile would do something like the above but would also embed the runtime. So it's not prolog calling a shared object but an app using the prolog runtime.

Ideally you would be able to call 'plld' to generate both versions of the app: What I haven't been able to do is compile the app using mingw32-gcc on unix and embed the win32 runtime into it.

So one question might be what is the win32 runtime and how do I glue it to a (cross-)compiled application??

Does lipl.lib contain the runtime or is it plcons.exe?

Would it work compiling an app and linking with libpl.lib then concatenating the plcons.exe file??

> Let me know if this was any help.
It is the first example of doing this I have seen - many thanks.





<Prev in Thread] Current Thread [Next in Thread>