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:
  1. ; -------------------------------------------------------------
  2. ;
  3. ; InvokeFuncAsm - Invokes a function through a function pointer passed as
  4. ; the first argument. All other parameters are forwarded on, plus the return
  5. ; value of the function invoked is returned.
  6. ;
  7. ; Copyright (c) Richard Birkby, ThunderMain ltd, November 2001
  8. ;
  9. ; -------------------------------------------------------------
  10.  
  11. .386
  12. .model flat
  13.  
  14. option prologue:none
  15. option epilogue:none
  16. option dotname
  17.  
  18.  
  19. .code
  20. align DWORD
  21. DllMain     proc    stdcall public, instance:DWORD, reason:DWORD, reserved:DWORD
  22.         mov     eax, 1  ; success
  23.         ret 12
  24. DllMain     endp
  25.  
  26.  
  27. align DWORD
  28. InvokeFunc  proc    stdcall public, funcptr:DWORD
  29.  
  30.     pop ecx ; save return address
  31.     pop edx ; Get function pointer
  32.     push    ecx ; Restore return address
  33.     jmp edx ; Transfer control to the function pointer
  34. InvokeFunc  endp
  35.  
  36. end

Thanks for your Help!