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

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


C Python (www.python.org) should work just fine.

slide


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

> Thanks for the response, that answer that then ;-)****
>
> ** **
>
> Is there any other Python implementation on Windows that will work?****
>
> ** **
>
> With other languages  I mean that I have tested the DLL in TCL and just
> straight ‘C’ and it works great… ****
>
> ** **
>
> ** **
>
> Matt****
>
> ** **
>
> *From:* Slide [mailto:slide.o.mix at gmail.com]
> *Sent:* Monday, August 5, 2013 5:45 PM
> *To:* Matt Tatro
> *Cc:* ironpython-users at python.org
> *Subject:* Re: [Ironpython-users] Windows C-DLL and find_module issues****
>
> ** **
>
> 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 ****
>



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


More information about the Ironpython-users mailing list