I'm new to c++/cli and would like to write a little managed wrapper for the nvapi.
Now when trying to access some functions (e.g. NvAPI_Initialize)
Visual Studio tells me that this function is not defined:
#include "nvapi.h";
NvAPIStatus Nv_GPU_ThermalAPI::M_NvAPI_GPU_GetThermalSettings(System::UIntPtr gpuHandle,
Nv_Thermal_Target sensorIndex,
[Out] array<Nv_GPU_Thermal_Settings^>^% settings)
{
NvAPI_Status res = NvAPI_Status::NVAPI_OK; // OK
NvPhysicalGpuHandle handle; // OK
NV_GPU_THERMAL_SETTINGS *settings; // OK
res = NvAPI_Initialize(); // Error
res = NvAPI_GPU_GetThermalStatus(handle, 0, settings); // same here
}
I've included the nvapi.lib as described here.
Additional VS tells me that in e.g.
NVAPI_INTERFACE NvAPI_Initialize();
NVAPI_INTERFACE is missing an explicit type and that 'int' would be assumed.
Trying to build my code this message turns into C2059: syntax error 'return' and VS cancels the build after 100 errors.
I'm using VS 2013 Pro.
Edit: NVAPI_INTERFACE is defined as follow:
'#define NVAPI_INTERFACE extern __success(return == NVAPI_OK) NvAPI_Status __cdecl'
Found the answer myself. It seems one has to add
#include <Windows.h>
to nvapi.h.