T
Tim Johnson
From C# I tried to P/Invoke a C-style function in a simple 1-function DLL I
created with evc++4.0. It fails with MissingMethodException. I finally
figured out it's because the exported function name is decorated by the
compiler/linker, so instead of "Myfcn" it's ?Myfcn@@YAHZZ. If I use
EntryPoint it works:
[DllImport("mydll.dll", EntryPoint="?Myfcn@@YAHXZ")]
public static extern int Myfcn();
I can also use EntryPoint="#1" (the ordinal number).
My question is: how can I get the compiler to NOT decorate this simple
C-style function? My real goal is to be able to create flat C-style
wrappers for a legacy C++ class-based dll we havehere, but I'd really like
to use the standard names of my flat functions, not either of the above
tricks.
Tim Johnson
created with evc++4.0. It fails with MissingMethodException. I finally
figured out it's because the exported function name is decorated by the
compiler/linker, so instead of "Myfcn" it's ?Myfcn@@YAHZZ. If I use
EntryPoint it works:
[DllImport("mydll.dll", EntryPoint="?Myfcn@@YAHXZ")]
public static extern int Myfcn();
I can also use EntryPoint="#1" (the ordinal number).
My question is: how can I get the compiler to NOT decorate this simple
C-style function? My real goal is to be able to create flat C-style
wrappers for a legacy C++ class-based dll we havehere, but I'd really like
to use the standard names of my flat functions, not either of the above
tricks.
Tim Johnson