Re: Problem in calling custom shared library from python
Jarkko Vatjus-Anttila <[email protected]> Thu, 8 Mar 2012 22:13:08 +0200
| Newsgroups | gmane.comp.python.ctypes |
|---|---|
| Message-ID | <CAP8GwZ9f4rQouRD_k0dUsc3C8PGr9EByybvDJBdDe0jnF6ZasA@mail.gmail.com> |
On Thu, Mar 8, 2012 at 3:25 PM, Thomas Heller <[email protected]> wrote: > > > The h2xml/xml2py tools parse the header file and then look for the > functions in the shared library, but they only look for the unmangled > names - they don't support C++ name mangling. > > So, it would be best (if you can control the C/C++ source code) to > change the header so that the functions are compiled with unmangled > names. OTOH, the simple header file that you show above does not really > justify the use of h2xml/xml2py, instead you can trivially call the > functions with ctypes. > Thanks for the reply! Now that you say it aloud, it is obvious. :) The mangling is exactly because of the c++ compiler. I tried the same thing with C, and there is no problem in calling the functions with their real name, So, in that respect problem solved. For those c++ mangled types, the XML output from gcc-xml has all the needed information to format tables for python to make the calls with real function names. But, I take from your comment that this is not the task, nor purpose of the h2xml/xml2py pair. For that purpose I could write my own quick parser, if I see real need for it. And yes, the example was very simple and the tools would not be really needed for this case. But it was only for testing before I move the code into larger projects. Just to get the principles working. :) - Jarkko ------------------------------------------------------------------------------ Virtualization & Cloud Management Using Capacity Planning Cloud computing makes use of virtualization - but cloud computing also focuses on allowing computing to be delivered as a service. http://www.accelacomm.com/jaw/sfnl/114/51521223/ _______________________________________________ ctypes-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ctypes-users