|
-
May 7th, 2002, 07:12 PM
#1
Thread Starter
Frenzied Member
A (quite) simple ASM compiling question!
Hiya peeps...
Still working on a prog with kedaman (see our Icon question in the General Forums)...
We're currently working on the plugin-mechanism. We'll call Unmanaged (yes that's a .NET term, the core is written in C#) Dll.
The thing is, we're loading the DLL at runtime, and we ran into some problems calling the function... I looked up some stuff on the internet, and came accros this article that describes exactely our problem ( http://www.codeproject.com/csharp/dyninvok.asp )
As you can see, it uses some assembly code to fix the problem of the dynamicly calling of the function... yes, the guy included the source code, but didn't shipped a compiled version of the DLL, only the ASM code and a makefile (+ some test C# code which is inrelevant to the question)...
When I try to compile the code using Visual Studio.NET, I get some compiling errors (something about a namespace and stuff)...
Now could someone please tell me what the problem is with the code, or compile it for me and send the compiled version?
Here's the ASM code I try to compile:
VB Code:
; -------------------------------------------------------------
;
; InvokeFuncAsm - Invokes a function through a function pointer passed as
; the first argument. All other parameters are forwarded on, plus the return
; value of the function invoked is returned.
;
; Copyright (c) Richard Birkby, ThunderMain ltd, November 2001
;
; -------------------------------------------------------------
.386
.model flat
option prologue:none
option epilogue:none
option dotname
.code
align DWORD
DllMain proc stdcall public, instance:DWORD, reason:DWORD, reserved:DWORD
mov eax, 1 ; success
ret 12
DllMain endp
align DWORD
InvokeFunc proc stdcall public, funcptr:DWORD
pop ecx ; save return address
pop edx ; Get function pointer
push ecx ; Restore return address
jmp edx ; Transfer control to the function pointer
InvokeFunc endp
end
Thanks for your Help!
Jop - validweb.nl
Alcohol doesn't solve any problems, but then again, neither does milk.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|