I found in the resulting EXE the following
:401000  call  401200h

...
...
:401200 jmp dword ptr [402000h]
Why so? Isn't it just a garbage JMP?
Opening a MASM-generated EXE file with notepad, it's easy to find lots of "@"s attached to the code segment. This problem seem to exist in TASM as well.
I'm wondering why and wanna know about any approach that eliminates the JMP.
Thanx in advance.
Posted on 2002-02-13 23:38:11 by cealnz
MASM can build EXE files both ways, wityh the lookup table you mentioned or direct. Have a look at the utility in version 7 that makes a different type of include file from each library based on MASM's EXTERNDEF.

It is called "l2extia.exe" and has a text file with it to explain how to use it.

Regards,

hutch@movsd.com
Posted on 2002-02-14 00:42:29 by hutch--
Posted on 2002-02-14 00:53:35 by cealnz
A little tip I use :

with EXTERNDEF includes, I think you can not have type or arguments checking (without macros) at least...

I do all my coding using the original inc files (so Invoke do check my arguments type and numbers) BUT I assemble my final exe with the EXTERNDEF includes...
Posted on 2002-02-14 04:43:26 by JCP
I think its because the PE loader recalculates offsets (or checks if actuals import functions offsets are valid) at run-time, and its easier for him to browse a jmp table at a certain offset than replacing all calls in the concerned module.
Posted on 2002-02-14 05:28:46 by Axial
Readiosys,

Hutch generates PROTO statements with the EXTERNDEFs, so it does check the number of parms when you INVOKE. Give it a try. :)
Posted on 2002-02-14 06:33:21 by S/390
Readiosys,

<< Clipped >>
I do all my coding using the original inc files (so Invoke do check my arguments type and numbers) BUT I assemble my final exe with the EXTERNDEF includes...

I would like to use this technique myself.
Please explain how it is setup?

Thanks, P1
Posted on 2002-02-14 08:56:05 by Pone
after about 10 edits: damn it :) do what hutch said...
Posted on 2002-02-14 09:30:22 by mob
Thanks, P1
Posted on 2002-02-14 12:33:22 by Pone
Pone,

l2extia.exe is an alternative method of creating include files that uses EXTERDEF and a prototype for the API calls. MASM by default produces a lookup table for API calls and this is on the basis that API calls are slow anyway and the extra jump simply does not matter.

When you have many calls to the same API, Sendmessage() for example, the default method is a lot more efficient in code terms. The alternative method using the different prototypes is fort people who were worried about the extra jump. Just be aware that MASM32 which has the alternative method in a directory uses the default method and the different include files may not be compatible with all of the libraries or example code.

Regards,

hutch@movsd.com
Posted on 2002-02-14 16:56:41 by hutch--