News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

invoke instead of call

Started by lamer, May 02, 2005, 06:52:17 PM

Previous topic - Next topic

lamer

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.

hitchhikr

You probably need some prototypes for the dlls functions to use invoke.

lamer

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.

hitchhikr

That's normal i would say, where is the problem exactly ?
And what about pasting some bits of code ?

lamer

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]

AeroASM

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.

James Ladd

Do you have a .DEF files as well so specify the exported name ?

hutch--

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.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

farrier

It is a GOOD day to code!
Some assembly required!
ASM me!
With every mistake, we must surely be learning. (George...Bush)

pbrennick

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

lamer

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?  :(

AeroASM

If you want to pass parameters, then put in your own functions.