C DLL in MASM Dll uebersetzen

Offizieller deutscher Support für das MASM32 SDK. Download FAQ

Moderatoren: crack, Krüsty, Marwin

Antworten
AVt

C DLL in MASM Dll uebersetzen

Beitrag von AVt » Samstag 16. April 2005, 22:18

Playing with callbacks in Excel (and Maple) i found the
following code in an old MS article (KB171729) to be
compiled in C into a DLL with standard convention:

__declspec(naked) void Callback()
{

/* For procedures with return values of 8 bytes or less */
/* Get address to be called and fix-up return address */

_asm pop eax; // save return address
_asm pop ecx; // get address to JMP to
_asm push eax; // restore return address
_asm jmp ecx; // Jump to callback function....
}

Which works. And as Excel is slow that would be enough (for
concrete situations i do not need that 'general' solution),
the nice things is, that this will be called from Excel by
value (not by reference).

Out of curiousity i wanted to do that directly as assembler
DLL using MASM, not MSVC. But can not find out how to define
the function in MASM (ok, it is a proc, not a function ...,
but what to use for the parameters?).

Any advice what to do (i am a assembler moron)? TIA.

Axel

mail (at) axelvogt.de

AVt

Re: C DLL in MASM Dll uebersetzen

Beitrag von AVt » Samstag 16. April 2005, 22:22

sorry, aus gewohnheit hab ich das auf englisch geschrieben ...

Gast

Re: C DLL in MASM Dll uebersetzen

Beitrag von Gast » Sonntag 17. April 2005, 12:15

ok, ich glaub ich hab's, man laesst einfach die parameter fuer den aufruf weg.

Antworten