typedef struct
{
// The contents of this struct are platform-dependent and subject to
// change. You should not manipulate the contents of this struct directly.
/*New stuff*/
// HWND m_hWnd;
// HDEVNOTIFY m_hDevNotify;
} fdGlove;
FGLOVEAPI fdGlove *fdOpen(char *pPort, bool bOnlyAllowSingleConnection = false);
FGLOVEAPI int fdClose(fdGlove *pFG);
FGLOVEAPI int fdGetGloveHand(fdGlove *pFG);
FGLOVEAPI int fdGetGloveType(fdGlove *pFG);
I have a DLL file called fglove.dll and I need using C# to call it.
I have written code like this:
[StructLayout(LayoutKind.Sequential)]
public class fdGlove
{
}
[DllImport("fglove.dll")]
public static extern fdGlove fdOpen(string pPort, bool bOnlyAllowSingleConnection);
but when I debug the program it is has an error (Unable to find an entry point named ‘fdOpen’ in DLL ‘fglove.dll’.)
Can someone point out what I have done wrong?
look at the name of the exported symbol in Dependency Walker. More than likely it will be _fdImport or something similar and you will need to update your DLLImportAttribute to match the exported name.