[Ironpython-users] Windows C-DLL and find_module issues

Matt Tatro matttatro at gmail.com
Mon Aug 5 22:03:54 CEST 2013


Hi Everyone,

 

I am struggling with what I thought would be something simple.even though I
am not that familiar with Python.

 

I generated a Python interface file using SWIG for a C-DLL. No errors doing
that. When the 'import' is used and the code of the SWIG generated file
executes it cannot find the DLL.

 

Below the code snippet from the SWIG generated PY file:

 

from sys import version_info

if version_info >= (2,6,0):

    def swig_import_helper():

        from os.path import dirname

        import imp

        fp = None

        try:

            fp, pathname, description = imp.find_module('_Hamlib',
[dirname(__file__)])

        except ImportError:

            import _Hamlib

            return _Hamlib

        if fp is not None:

            try:

                _mod = imp.load_module('_Hamlib', fp, pathname, description)

            finally:

                fp.close()

            return _mod

    _Hamlib = swig_import_helper()

    del swig_import_helper

else:

    import _Hamlib

del version_info

 

 

Essentially the 'find_module' cannot find the DLL (which is in the same
directory and I have used dependency walker). What I have found is that
using 'get_suffixes' only returns one extension 'py' - nothing else. I have
tried renaming the DLL to PYD, but that doesn't help either. The actual dll
file is 'libhamlib-2.dll' and changing the filename doesn't help. 

 

Using the DLL in other languages works fine.

 

Any help out there? I am using the latest version of IronPython and VS 2012.

 

Thanks

 

 

Matt

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20130805/af5ba739/attachment.html>


More information about the Ironpython-users mailing list