digitalmars.D.learn - importing DLL
- BCS (2/2) Mar 27 2008 I have a DLL with no .h no .def and nothing but the DLL. What are my odd...
- Neal Alexander (2/6) Mar 28 2008 implib.exe
- BCS (4/12) Mar 28 2008 Tried that. It gives me a .lib (that doesn't seem to work but I could be...
- Frits van Bommel (17/30) Mar 28 2008 If you don't know what functions it defines things get tricky.
- Regan Heath (4/17) Mar 28 2008 Do you have a copy of dumpbin:
- BCS (2/21) Mar 28 2008 I will soon.
- BCS (3/25) Mar 28 2008 correction, I have it but it's not working (not installed correctly or s...
- Neal Alexander (6/35) Mar 29 2008 The .lib should work for linking.
I have a DLL with no .h no .def and nothing but the DLL. What are my odds of linking it in with a D app?
Mar 27 2008
BCS wrote:I have a DLL with no .h no .def and nothing but the DLL. What are my odds of linking it in with a D app?implib.exe
Mar 28 2008
Neal Alexander wrote:BCS wrote:Tried that. It gives me a .lib (that doesn't seem to work but I could be mistaken) but I still don't know what functions are defined. (maybe I should have added "no documentation")I have a DLL with no .h no .def and nothing but the DLL. What are my odds of linking it in with a D app?implib.exe
Mar 28 2008
BCS wrote:Neal Alexander wrote:If you don't know what functions it defines things get tricky. IIRC you should be able to determine their names somehow, but most DLLs use C-like mangling[1] so there's no sure way to know what parameters they expect or what they return. And even if it's a (non-D[2]) mangling with parameter and type info it's not much better unless you feel like writing e.g. some extern "C" C++ bindings. (Though then at least you know that should work, provided you can demangle them) I do seem to remember "stdcall"[3]-mangled names include the number of bytes of parameters they expect though, so if based on that and the function name you can make an educated guess as to their parameters and return type... [1]: In other words: pretty much no parameter & return type information. [2]: For D mangling, running it through Phobos' std.demangle should produce enough info to declare the right functions. [3]: "extern(Windows)"BCS wrote:Tried that. It gives me a .lib (that doesn't seem to work but I could be mistaken) but I still don't know what functions are defined. (maybe I should have added "no documentation")I have a DLL with no .h no .def and nothing but the DLL. What are my odds of linking it in with a D app?implib.exe
Mar 28 2008
BCS wrote:Neal Alexander wrote:Do you have a copy of dumpbin: http://support.microsoft.com/kb/177429 ReganBCS wrote:Tried that. It gives me a .lib (that doesn't seem to work but I could be mistaken) but I still don't know what functions are defined. (maybe I should have added "no documentation")I have a DLL with no .h no .def and nothing but the DLL. What are my odds of linking it in with a D app?implib.exe
Mar 28 2008
Reply to Regan,BCS wrote:I will soon.Neal Alexander wrote:Do you have a copy of dumpbin: http://support.microsoft.com/kb/177429 ReganBCS wrote:Tried that. It gives me a .lib (that doesn't seem to work but I could be mistaken) but I still don't know what functions are defined. (maybe I should have added "no documentation")I have a DLL with no .h no .def and nothing but the DLL. What are my odds of linking it in with a D app?implib.exe
Mar 28 2008
Reply to Benjamin,Reply to Regan,correction, I have it but it's not working (not installed correctly or some such, More fun!)BCS wrote:I will soon.Neal Alexander wrote:Do you have a copy of dumpbin: http://support.microsoft.com/kb/177429 ReganBCS wrote:Tried that. It gives me a .lib (that doesn't seem to work but I could be mistaken) but I still don't know what functions are defined. (maybe I should have added "no documentation")I have a DLL with no .h no .def and nothing but the DLL. What are my odds of linking it in with a D app?implib.exe
Mar 28 2008
BCS wrote:Reply to Benjamin,The .lib should work for linking. Use some PE utility to find the exports - StudPE is ok i think. or you can modify this code to dump the export table and generate a D header for your self: http://svn.dsource.org/projects/kong/trunk/kong/examples/import_dump.dReply to Regan,correction, I have it but it's not working (not installed correctly or some such, More fun!)BCS wrote:I will soon.Neal Alexander wrote:Do you have a copy of dumpbin: http://support.microsoft.com/kb/177429 ReganBCS wrote:Tried that. It gives me a .lib (that doesn't seem to work but I could be mistaken) but I still don't know what functions are defined. (maybe I should have added "no documentation")I have a DLL with no .h no .def and nothing but the DLL. What are my odds of linking it in with a D app?implib.exe
Mar 29 2008