Using dllimport
I am trying to use the attribute DllImport
in the following code:
[DllImport("grfinger.dll",EntryPoint="_grstartenroll@4")]
public static extern int startenroll(int context);
to get the function name i used dumpbin / export. When I run the code, I get the following exception:
Unable to find an entry point name '_grstartenroll@4' in DLL 'grfinger.dll'
...
How can I resolve this error?
_grstartenroll @ 4 is the name of the decorated function in the dll.
This is similar to the standard naming conventions, you can try:
[DllImport("grfinger.dll",EntryPoint="_grstartenroll@4", CallingConvention=CallingConvention.StdCall]
public static extern int startenroll(int context);
Otherwise I would try to get the name of the undecorated function, you can pipe the dumpbin output to undname like this:
dumpbin / exports grfinger.dll | undname _grstartenroll @ 4
and then use undecorated name in your dll import.
Without any information about a specific function or library: I believe that specifying the entry point as entrypoint="startenroll"
or entrypoint="#4"
instead of dumpbin output might help.