[Tutor] Re: [Swig] C++ Extension Problems (Part1)

William S Fulton wsf@fultondesigns.co.uk
Mon, 4 Feb 2002 20:04:19 -0000


Marcus,

I got this to work, but had to set up a release build first as the debug
build wanted a debug library (python21_d.lib) which isn't distributed, not
with my Python anyway. I just had to set the $(PYTHON_LIB) and
$(PYTHON_INCLUDE) paths in the release build for the DLL to be built. Also
in your test script file, simannealfile.py, use:

instance1=simannealfile.new_simulated_annealing

and not
instance1=simannealfile.simulated_annealing

as you didn't pass swig -shadow on the commandline. Also make sure that the
produced dll is in the same directory as the python script you are running
or put it in the path, or setup Visual C++ to output the dll to the same
directory as all your .py script files (Use link tab - output file name in
the build settings).

Hope that gets you going.

Regards
William

----- Original Message -----
From: Keule
To: SWIG ; Tutor
Sent: Sunday, February 03, 2002 4:30 PM
Subject: [Swig] C++ Extension Problems (Part1)


Hi @ ALL !

Iīve created a .dll file with SWIG under windows. Now i want to use it and
try to import it into the simannealfile.py modul, but pythonwin always gives
the following error:

File "C:\Python21\Pythonwin\pywin\framework\scriptutils.py" , line 394, in
ImportFile
    exec codeObj in __main__.__dict__
  File "<auto import>", line 1, in ?
ImportError: DLL load failed: Das angegebene Modul wurde nicht gefunden.
Traceback (most recent call last):
  File "C:\Python21\Pythonwin\pywin\framework\scriptutils.py" , line 301, in
RunScript
    exec codeObject in __main__.__dict__
  File
"C:\Arbeit_Diplomarbeit\__Optimierer\TEM\simannealfile\simannealfile.py" ,
line 2, in ?
    import simannealfile
ImportError: DLL load failed: Das angegebene Modul wurde nicht gefunden.

I checked out the examples ,delivered with SWIG, and compared them with my
Settings under Visual C++. The Examples are all functioned and now i
absolutly didīnt know whats going wrong and why i always get the
Errormessage above. I īve put my files with these mail.
Perhaps anyone of you could check my settings an can give me an advice
whatīs going wrong.

Thanks a lot
Greetings
Marcus