April 25, 2024, 06:39:49 PM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


nvapi.lib error

Started by King64, January 22, 2017, 04:13:42 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

King64

Hi guys, i'm working around my Gigabyte GeForce 210, and i'd like to be able to access NVidia APIs. I wrote a very basic program to load and load nvapi.dll, using nvapi.lib that comes with NVidia SDK, but the EBasic compiler reports following errors:

Unresolved external NvAPI_Initialize
Error: Unresolved extern NvAPI_Initialize
Error: Unresolved extern NvAPI_Unload

and that's is the code:

$USE "nvapi.lib"

DECLARE EXTERN NvAPI_Initialize(),INT
DECLARE EXTERN NvAPI_Unload(),INT

OPENCONSOLE

IF NvAPI_Initialize() <> 0
PRINT "Unable to Initialize NVAPI."
ELSE
PRINT "Library OK"
NvAPI_Unload()
DO:UNTIL INKEY$<>""
ENDIF
END


Any suggestion?  ??? Thanks in advance  :)

Andy

You need to make sure the nvapi.lib file is in your C:\IWBDev3\libs folder.

Alternatively, compile the source code in the same folder as the nvapi lib file.

Try that.

Andy.
:)
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

King64

Hi Andy, the nvapi.lib is present in the libs dir. The NVAPI documentation says:
Quote
NvAPI cannot be dynamically linked to applications. You must create a static link to the library and then call NvAPI_Initialize(), which loads nvapi.dll dynamically...
So i write a small wrapper like a static .lib file, adding nvapi.lib into the project

$USE "nvapi.lib"

DECLARE CDECL EXTERN NvAPI_Initialize(),INT
DECLARE CDECL EXTERN NvAPI_Unload(),INT

GLOBAL __NvAPI_Initialize
GLOBAL __NvAPI_Unload

SUB __NvAPI_Initialize(),INT

RETURN NvAPI_Initialize()

ENDSUB


SUB __NvAPI_Unload(),INT

RETURN NvAPI_Unload()

ENDSUB

and using it

$USE "nVGPU.lib" ' my wrapper

DECLARE EXTERN __NvAPI_Initialize(),INT
DECLARE EXTERN __NvAPI_Unload(),INT

OPENCONSOLE

IF __NvAPI_Initialize() <> 0
PRINT "Unable to Initialize NVAPI."
ELSE
PRINT "Library OK"
__NvAPI_Unload()
ENDIF
DO:UNTIL INKEY$<>""
END

but it returns the same error
??? ??? ???