In a message dated 6/29/01 4:05:44 PM Mountain Daylight Time,
rlight@argoneng.com writes:


OK, this is where I'm at: The third party Win32 DLL is closed source and
was built using some version (probably the latest) of MSVC++.  I don't
have either the original import libraries (.a's) or module definitions
(.def's) from the people who created the DLL :(




Tried this before, I'll see what I can dredge up.


This is what I've tried: Using this little 4k program called IMPDEF.EXE
by Ismael Jurado, I created the .def files like so:






So my question to ya'll is this: Should I just give it up or is there
hope yet?  Is there another way to create the import libraries from the
MSVC++ DLL using dlltool/dllwrap?  If so, how?




OK, here is what my (very little) experience has been.  The following will
only work if the functions in question are defined as __stdcall, or something
that means the same (such as WINAPI).  Impdef should create a good def file,
but you need to go into the def file and add the @0 or @4 stdcall things at
the end.  To figure out how to add those, just count the bytes that are
passed into the function in question, and then add @bytes to the function in
the def.
e.g.
(header)
void foo(long variable);
(def)
EXPORTS
foo@4
and then call dlltool like so:
>dlltool -k -D dllname.dll -d mydef.def -l libout.a

Obviously, change the input dll, def and output lib to suit your purpose.
 The -k kills the @x in the final "alias." (or whatever the devil it is
called)

If the functions are not __stdcall, then here is what you can try. (note:
 the following is just shaky instructions from me and may not work.)
When you try to link your prog with the implib you have made, it will give
you an error saying undefined reference, correct?  Take that reference
(exactly as it is shown) and put it in a new .def file like so:

EXPORTS
RefAsShownByLD

then, use impdef on the dll to get all the references from the dll.  Put this
in .def like so:

EXPORTS
RefAsShownByLD = SimilarRefFromImpdef

then dlltool -D dllname.dll -d mydef.def -l libout.a.
Also, be sure to run program until the point of a function call from DLL, as
sometimes it can link correctly but not call the right symbol in the dll.

Sorry, I don't know how experienced you are with this stuff, so I am sorry if
I sounded condescending or anything, I just wish to give any info needed by
even a newbie.  The first process was used by me to port a third pary dll
made by msvc++, it is a c++ dll.  It works fine.

--Jason

P.S. -sorry if my quotes are weird, aol tends to mess a lot of stuff up.