Reputation: 63
Is it possible to use the NVIDIA tools extension library, nvtx, from C#?
So far I have tried the following:
[DllImport(@"C:\Program Files\NVIDIA Corporation\NvToolsExt\bin\x64\nvToolsExt64_1.dll",
CallingConvention = CallingConvention.Cdecl)]
public static extern void nvtxRangePushA(string message);
[DllImport(@"C:\Program Files\NVIDIA Corporation\NvToolsExt\bin\x64\nvToolsExt64_1.dll",
CallingConvention = CallingConvention.Cdecl)]
public static extern void nvtxRangePop();
In my .cs files I have the following:
nvtxRangePushA("hi");
//some work
nvtxRangePop();
Doing so I get an error:
An unhandled exception of type 'System.BadImageFormatException' occurred in myProgram.exe
Upvotes: 1
Views: 479
Reputation: 318
The exception that you're seeing most likely due to different platforms of your code and NVTX (x86 vs x64). Make sure that your application is compiled using x64 platform.
Upvotes: 1