2

I'm trying to use the DllImport attribute 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?

agf
  • 171,228
  • 44
  • 289
  • 238
sagi
  • 21
  • 2

2 Answers2

5

_grstartenroll@4 is the decorated function name in the dll.

That looks like standard calling convention naming, you could try:

[DllImport("grfinger.dll",EntryPoint="_grstartenroll@4", CallingConvention=CallingConvention.StdCall]
public static extern int startenroll(int context);

Otherwise I would try and get the undecorated function name, you can pipe the output of dumpbin to undname like this:

dumpbin /exports grfinger.dll | undname _grstartenroll@4

and then use the undecorated function name in your dll import.

vgru
  • 49,838
  • 16
  • 120
  • 201
ParmesanCodice
  • 5,017
  • 1
  • 23
  • 20
0

Without knowning anything about the specific function or library: I believe specifying the entrypoint as entrypoint="startenroll" or entrypoint="#4" instead of the dumpbin output might help.

Johan Kullbom
  • 4,183
  • 26
  • 28