I bought a USB IR reciever and installed the driver. The developer
kit gives a DLL with the following information:
C++ Builder / Microsoft Visual C++:
#ifdef __cplusplus
extern "C" {
#endif
int __stdcall DoGetInfraCode(uchar * code, int extra, int *
codeLen);
#ifdef __cplusplus
}
#endif
So in my C# project I have done this:
public class IgorUSB
{
[DllImport("IgorUSB.dll")]
public static extern int DoGetInfraCode(ref byte[] code, int
extra, ref int codeLen);
}
Which I assume it the correct way to define the wrapper to the dll.
Next I added this to my Windows Form:
private void Form1_Load(object sender, EventArgs e)
{
byte[] code = new byte[12];
int extra = 0;
int len = 0;
IgorUSB.DoGetInfraCode(ref code, extra, ref len);
}
But I get the following error when I run it:
"LoaderLock was detected
Message: Attempting managed execution inside OS Loader lock. Do not
attempt to run managed code inside a DllMain or image initialization
function since doing so can cause the application to hang."
Does my code look correct? The only thing I can think of is the when
this DLL is loaded it pops up a message box. Could that be the
problem?