RE: dPERINTERP/MY_CXT (was: speeding up XS_DBI_dispatch())

"Jan Dubois" <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.dbi.sybase.devel
Organization ActiveState Software Inc
Message-ID <[email protected]>
On Fri, 10 Feb 2012, Tim Bunce wrote:
> On Fri, Feb 10, 2012 at 03:27:24PM +0000, Dave Mitchell wrote:
> >
> > If anyone knows of a more elegant way to make a function from DBI.xs
> > available to DBD:: code, please let me know!
> 
> I hope to take a proper look in the next day or so.

The "standard" way nowadays seems to be to use ExtUtils::Depends. I'm
not convinced though that it is any more elegant than the method you are
already using.

An example module using ExtUtils::Depends is B::Hooks::OP::Check.

It is important to also list all exported functions in the FUNCLIST
parameter to MakeMaker; otherwise the symbols will not be exported on
AIX and Windows.

Personally I've just added names to FUNCLIST, and then called
dlopen/dlsym or LoadLibrary/GetProcAddress on the embedding side (not
actually another module, but an app hosting a Perl interpreter).

Ideally you should be able to do this with the DynaLoader dl_load_file()
and dl_find_symbol() functions, but I found some claims (in the FFI
module docs) that this has problems on Windows. I don't know what those
problems are, but it looks like dl_load_file() on Windows will return a
handle to the current executable when the requested library cannot be
found. I have no clue why it is doing that.

So, in summary, I think the current approach isn't such a bad solution
at all. :)
Cheers,
-Jan
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.