Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^3: XS with DLL

by syphilis (Archbishop)
on Jun 05, 2014 at 15:33 UTC ( [id://1088869]=note: print w/replies, xml ) Need Help??


in reply to Re^2: XS with DLL
in thread XS with DLL

What I really want to do is to work with a third-party DLL for which I have a dll.h header file and an Exports.def file. I don't have a static version

I don't know how you can create a static library with that, but you could create an import library for the dll:
dlltool --kill-at --input-def your.def --output-lib lib_choose_a_name. +a
Then you need to link to lib_choose_a_name.a when building the project.
I don't know how to link the XS code to that import library without using ExtUtils::MakeMaker.

The dll will still be need to be found at runtime (so it needs to be in the path or the cwd) but the code in the XS file you originally presented should then need no modification - assuming, of course, that "dll.h" contains the declaration of the "own_function" function (and that your dll exports that function).

Cheers,
Rob

Replies are listed 'Best First'.
Re^4: XS with DLL
by soren.hein (Initiate) on Jun 05, 2014 at 19:40 UTC

    Thanks, Rob. I eventually figured out where DynaLoader was looking for simplelib.dll when it was loading glue.dll, and it was not where glue.dll was located... The fix was to chdir to the directory of glue.dll, rather than passing a full path to DynaLoader.

    Thanks again. I hope I'll never have to think about linking like that again :-).

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1088869]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (4)
As of 2024-04-24 06:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found