[Tutor] RE: [Swig] Compiling problem using SWIG to create a dll under win dows

C Smith csmith@bitaplus.com
Fri, 1 Feb 2002 17:13:42 -0000


Dear Marcus,
If you just want to create a wrapper dll, you don't need to use Visual =
C++.
Just write a makefile like this.
For PYTHON, do something like this

________________________________________________________________________=
____
______________
PVERS=3D22
PYTHON=3Dd:\python$(PVERS)
MYLIB=3Dyourlib.lib
LIBp=3Dpython$(PVERS).lib
PATH=3De:\gcc\SWIG-1.3.11;$(PATH)

wrapc.dll:	wrap.obj wrap.i=20
	link -dll  -OUT:$@ $(PYTHON)\libs\$(LIBp) $(MYLIB)  wrap.obj

.cpp.obj:
	cl -c $<  -MD -W3 -Gm -GX -Zi -I$(PYTHON)\include -I./ -DWIN32=20
.c.obj:
	cl -c $<  -MD -W3 -Gm -GX -Zi -I$(PYTHON)\include -I./ -DWIN32=20

clean:
	del *.obj

wrap.cpp:	wrap.i  something.h
	echo ########################### Using Python Version $(PVERS)
###############
	swig -version
	swig -python -shadow -c++ -module wrap -o $@ wrap.i=20
________________________________________________________________________=
____
______________


If you call the file makefile, then from the dos prompt just type

nmake

This is quite useful. If you wanted to make a wrapper for python20 you =
could
say

nmake PVERS=3D20

You don't need to to start up Visual C++ and you can add lines to copy =
the
dll to where you want it.

Cheers,

Colin
-----Original Message-----
From: Keule [mailto:m_konermann@gmx.de]
Sent: 01 February 2002 15:45
To: SWIG; Tutor
Subject: [Swig] Compiling problem using SWIG to create a dll under =
windows


Hi @ ALL !

I think i solved my first problem creating a .dll with Visual C++, =
because
first i choosed only the option "win32 dynamic link library" and not =
the
"MFC AppWizard". The AppWizard also creates a .def file where are
informations about the Exports from the new .dll file.
But now, after compiling the the whole code, using the AppWizard, the
following Error occurs:

Kompilierung l=E4uft...
simanneal.cpp
c:\arbeit_diplomarbeit\__optimierer\testlauf\bla bla\simanneal.cpp(496) =
:
fatal error C1010: Unerwartetes Dateiende waehrend der Suche nach der
Direktive fuer die vorkompilierte Header-Datei
simanneal_wrap.cpp
c:\arbeit_diplomarbeit\__optimierer\testlauf\bla =
bla\simanneal_wrap.cpp(34)
: warning C4005: 'SWIGEXPORT' : Makro-Neudefinition
        c:\arbeit_diplomarbeit\__optimierer\testlauf\bla
bla\simanneal_wrap.cpp(32) : Siehe vorherige Definition von =
'SWIGEXPORT'
....
Generieren von Code...
Fehler beim Ausf=FChren von cl.exe.

bla bla.dll - 7 Fehler, 4 Warnung(en)


Perhaps, i have to write additional information in the .def file of the
functions, i want to be exported from the new .dll=20
Have anyone had this kind of problem ?

Greetings
Marcus