most likely, the function is not properly exported, use DumpBin to find out the exact entry point name, and then try [DllImport("DeviceControl.dll", EntryPoint="_f@4",
CallingConvention=CallingConvention.StdCall)]
CallingConvention=CallingConvention.StdCall)]
extern "C" { __declspec ( dllexport ) long __cdecl f(long i)
{
return i;
}
}