Re: Using ctypes inside a C application embedding the CPython runtime

"[email protected]" <[email protected]> Thu, 9 Jun 2016 10:35:01 -0600
Newsgroups gmane.comp.python.ctypes
Message-ID <CAJhOshvLKZEPHQAwUrq_E_b4hsScJOJDBhx7LptRO96eQhpeuQ@mail.gmail.com>
Hi Eryk,

On Tue, Jun 7, 2016 at 9:36 PM, eryk sun <[email protected]> wrote:

> On Tue, Jun 7, 2016 at 10:06 PM, [email protected]
> <[email protected]> wrote:
> >
> > If filename is NULL, then the returned handle is for the main
> >        program.  When given to dlsym(), this handle causes a search for a
> >        symbol in the main program, followed by all shared objects loaded
> at
> >        program startup, and then all shared objects loaded by dlopen()
> with
> >        the flag RTLD_GLOBAL.
> >
> > As documented on dlopen's manpage[1], and this is working right now. What
> > we're worried about is that passing None to the CDLL constructor is not
> > documented anywhere (at least that I could find), so we're not sure if we
> > can rely on this functionality (if so, the documentation should probably
> be
> > updated and I can help with that if needed) or if there's an alternate
> > recommended and documented way of achieving the same result.
>
> This should have been documented for POSIX systems, which rely on this
> feature internally for `pythonapi = PyDLL(None)`.
>

Great to read that! Is there any way I can help to get this documented?
Should I submit a PR to the documentation or something like that?


> Of course, Windows LoadLibrary doesn't accept NULL, so CDLL(None) is
> an error there. It could be special cased as GetModuleHandle(NULL),
> but that's rarely useful in this context since there's no global
> symbol table.
>

Yes, you're right, I was only thinking about the specific context of my
problem (we're using Linux).


Regards,

-- 
Jeffrey Esquivel S.

------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity 
planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e

_______________________________________________
ctypes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ctypes-users