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