Hi all!
I have just written my first DLL in ASM! :dance:
And I am a bit confused: if I work with LoadLibrary etc - I have to point to functions of DLL by call - but I want by invoke. If I add incudes to .inc and .lib. files - I can point to functions by invoke, but then the DLL is loaded when the main program starts. Is there any way to load DLL by demand and work with invoke? Like in VB, for example - I just can add Declare and point to function at any time.
You probably need some prototypes for the dlls functions to use invoke.
Where?
I have them in .inc file - but if add it in include, I pass the linking, but fail on build with: error LNK2001: unresolved external symbol _blablabla@8 - until I add icludelib for .lib file.
That's normal i would say, where is the problem exactly ?
And what about pasting some bits of code ?
OK, this is the DLL and test project. The test project now works with LoadLibrary and call. I have commented lines with "invoke" and appropriate includes in .inc file. I have written it with RadAsm so I have added project files as well. Thanks.
[attachment deleted by admin]
Quote from: lamer on May 02, 2005, 07:06:16 PM
I pass the linking, but fail on build with: error LNK2001: unresolved external symbol _blablabla@8
That is a link error.
just to clarify: assemble means turn .asm into binary format, like COFF (.obj), OMF, flat etc
Linking was invented by Microsoft (i think??) and means turning .obj into .exe
Build means assemble, then link.
Do you have a .DEF files as well so specify the exported name ?
lamer,
You can stop guessing and actually have a look at the tutorial in the forum web site for constructing a DLL. Once you get the idea they are simple enough to do.
lamer,
You might want to look at:
http://www.masmforum.com/simple/index.php?topic=694.0
Hth
farrier
The DLL entry point does not look correct to me. It need something like the following:
.if reason==DLL_PROCESS_ATTACH ; When the dll is loaded
;call the procedure here
.endif
Then, if that procedure is the only call in the DLL, you do not need .lib or .inc, just load the dll and it will execute immediately. I use this method with my Spash screen DLL. If you need the example, I will attach it, just ask.
Paul
Quote from: pbrennick on May 03, 2005, 02:17:04 PM
it will execute immediately.
And what if I should pass parameters to function? And get them back? Do it at DLL entry point? :(
If you want to pass parameters, then put in your own functions.