Unable to import dll extension that relies on a second dll

John M. Camara camara at home.com
Tue Aug 14 23:39:07 EDT 2001


I have not been able to create a Python extension in Windows 
that requires a call to a function in another dll.  In the 
simplified example below a function called foo in extension.dll 
calls bar a function in supporting.dll.  I used SWIG to wrap the 
functions in extension.dll and compiled both dlls in Borland C++ 
Builder 5.  When I try to import the extension I get an import 
error stating that the module could not be found.

If I change foo so that it does not depend on the supporting.dll, 
the extension imports just fine.  I know I must be doing something 
wrong as I should be able to call a function in another dll in the 
extension wihout any problems.  Any ideas?

/*** start of extension.dll **/

extern "C" __declspec(dllimport) float bar(float x);

float fun1(float x)
  {
    ...
    return ...
  }

float fun2(float x)
  {
    ...
    return ...
  }

...

float foo(float x)
  {
    return bar(x);
  }

/*** end of extension.dll ***/

/*** start of supporting.dll ***/

extern "C" __declspec(dllexport) float bar(float x)
  {
    ...
    return ...
  }

/*** end of supporting.dll ***/



More information about the Python-list mailing list