The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: BlackVortex on March 08, 2010, 09:00:51 AM

Title: Question about lib import library and dynamic library
Post by: BlackVortex on March 08, 2010, 09:00:51 AM
I'm using an opensource library, which comes with a lib file and a dll file. The lib file doesn't seem to contain code, only the imports themselves, so I guess it's an "import library"
Goasm doesn't even need/use the lib file, it invokes like this : invoke dllname:function

My question is : can I merge the library's code in my own, so I don't have to have the whole dll in the same folder ? Some kind of static linking ?
Maybe some polib magic ?

This isn't a goasm specific question, that's why I'm posting here.
Title: Re: Question about lib import library and dynamic library
Post by: hutch-- on March 08, 2010, 09:39:25 AM

If the lib file just contains the DLL exports it will be no use to you. All you need to do is get the export list from ther DLL and you will know what to call from the DLL. You will need the argument types and count but there should be some data that comes with the DLL and LIB.
Title: Re: Question about lib import library and dynamic library
Post by: BlackVortex on March 08, 2010, 09:47:06 AM
I'm calling it just fine, it also has documentation, my question was whether I could statically link against that dll, so its code is contained in mine.

I want to have one released executable.
Title: Re: Question about lib import library and dynamic library
Post by: redskull on March 08, 2010, 12:47:33 PM
I've never heard of any linker switch that does that, but if it's open source, you can always recompile it as a static library and do it the 'normal' way.  Depending on how much initialization it does (globals, settings, etc), you might have to do some major surgery, though.  At the very least, reimplement the DLL main as part of your init. code.

-r
Title: Re: Question about lib import library and dynamic library
Post by: dedndave on March 08, 2010, 04:53:13 PM
seems like there ought to be a way to treat it as a resource file
i am too much of a n00b at this stuff - lol
i bet Erol knows a way, though
of course, disassembly is another way to go - but that seems like cheating
Title: Re: Question about lib import library and dynamic library
Post by: joemc on March 08, 2010, 05:20:22 PM
You could put the whole dll in the .data section.  write it to a temporary directory, load it, and delete it when done :)
Title: Re: Question about lib import library and dynamic library
Post by: BlackVortex on March 08, 2010, 06:05:29 PM
 :bg  :toothy :bg

That looks like funny business, guys, dropping off dll in temp folder, hehe.

Since I have the source, can I make a static lib with it ? It's c++   :(

Title: Re: Question about lib import library and dynamic library
Post by: Vortex on March 08, 2010, 07:21:53 PM
Hi BlackVortex,

You can include the DLL in your executable :

Loading and running EXEs and DLLs from memory (http://www.masm32.com/board/index.php?topic=3150.0)
Title: Re: Question about lib import library and dynamic library
Post by: BlackVortex on March 08, 2010, 07:37:54 PM
That is awesome  :dazzled:

First I will finalize my project and then I will try your library, so that no weird bugs creep in.

Does the DllEntry of the attached-dll get executed ?
Title: Re: Question about lib import library and dynamic library
Post by: dedndave on March 08, 2010, 07:39:56 PM
i knew Erol had the stuff   :bg
at least i got that part right
Title: Re: Question about lib import library and dynamic library
Post by: Vortex on March 08, 2010, 07:41:29 PM
Hi BlackVortex,

The DllEntry point is not executed. You have to do it programmatically.