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

Slide slide.o.mix at gmail.com
Tue Aug 6 00:45:00 CEST 2013


IronPython does not support C based modules directly, you would have to
write a wrapper for your DLL in C# (or another .NET language) and have it
used from there.

When you say it works in other languages, what do you mean?

Thanks,

slide


On Mon, Aug 5, 2013 at 1:03 PM, Matt Tatro <matttatro at gmail.com> wrote:

> 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****
>
> _______________________________________________
> Ironpython-users mailing list
> Ironpython-users at python.org
> http://mail.python.org/mailman/listinfo/ironpython-users
>
>


-- 
Website: http://earl-of-code.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20130805/5980e37f/attachment.html>


More information about the Ironpython-users mailing list