Subject: [clisp-list] Re: FFI with a .dll (MSVC Makefile)

From: "Hoehle, Joerg-Cyril" <[email-masked]>
Date: Mon Mar 10 00:39:06 2003

Hi,

I've been asked for sample Makefiles. Here's what I added somewhere amid the makefile(.msvc5/6) that comes with the CLISP source.

See also my e-mail "now you can use the regexp module on MS-Windows" from 27.3.2002 which contains a makefile sample for modules/regexp/.

Matthew Williams wrote:
>modules.obj: error LNK2001: unresolved external symbol
>_module__mtest__init_function_2
>lisp:exe : fatal error LNK1120: 8 unresolved externals

################################ Joerg's module playground
genclisph.exe : genclisph.obj
	$(CC) $(CFLAGS) $(CLFLAGS) genclisph.obj /Fegenclisph.exe
clisp.h : genclisph.exe
	genclisph.exe > clisp.h

MODOBJECTS = \
ffimext.obj \
mtest.obj \
mcode.obj

# mtest.c ought to be generated from mtest.lisp FFI defs, while
# mcode.c contains hand-written C code.

mtest.obj : mtest.c clisp.h
	$(CC) $(CFLAGS) -c mtest.c
mcode.obj : mcode.c
	$(CC) $(CFLAGS) -c mcode.c

ffimext.c : ffimext.d # comment5.exe ansidecl.exe varbrace.exe
	$(COMMENT5) ffimext.d | $(ANSIDECL) | $(VARBRACE) > ffimext.c
ffimext.obj : ffimext.c sysdll.h # clisp.h
	$(CPP) $(CFLAGS) ffimext.c > ffimext.i.c
	$(CC) $(CFLAGS) -c ffimext.i.c
	$(RM) ffimext.obj
	$(MV) ffimext.i.obj ffimext.obj
	$(RM) ffimext.i.c

lispm.exe : $(MODOBJECTS) $(OBJECTS) modules.obj avcall.lib callback.lib iconv.lib sigsegv.lib data
	$(RM) lisp.ilk
	$(CC) $(CFLAGS) $(CLFLAGS) $(MODOBJECTS) $(OBJECTS) modules.obj $(LIBS) /link /out:lispm.exe
	editbin /stack:3145728 lispm.exe

It's all copy&paste&replace from other portions of the makefile. Note the lispm.exe target (instead of lisp.exe).

Regards,
	Jorg Hohle.