Get the API version
#define cszNxCoreAPIVersion "sNxCoreAPIVersion" typedef unsigned int (__stdcall *NxCoreAPIVersion) (void); unsigned int APIVersion();
Here's an example of printing out the version of the DLL at program startup
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include "NxCoreAPI.h" #include "NxCoreAPI_Wrapper_C++.h" NxCoreClass NxCore; int __stdcall nxCoreCallback(const NxCoreSystem* pNxCoreSys, const NxCoreMessage* pNxCoreMessage) { if(pNxCoreMessage->MessageType == NxMSG_STATUS && pNxCoreSys->Status == NxCORESTATUS_INITIALIZING) { unsigned int version = NxCore.APIVersion(); printf("NxCoreAPI.dll version is %d.%d.%d\n", NxCORE_VER_MAJOR(version), NxCORE_VER_MINOR(version), NxCORE_VER_BUILD(version)); // also can do this printf("NxCoreAPI.dll version is %d.%d.%d\n", NxCORE_VER_MAJOR(pNxCoreSys->DLLVersion), NxCORE_VER_MINOR(pNxCoreSys->DLLVersion), NxCORE_VER_BUILD(pNxCoreSys->DLLVersion)); return NxCALLBACKRETURN_STOP; } return NxCALLBACKRETURN_CONTINUE; } int main(int argc, char** argv) { if (!NxCore.LoadNxCore("NxCoreAPI64.dll") && !NxCore.LoadNxCore("NxCoreAPI.dll")) { printf("loading library failed\n"); return -1; } NxCore.ProcessTape(argv[1], 0, NxCF_EXCLUDE_CRC_CHECK, 0, nxCoreCallback); return 0; } |
import net.nanex.NxCoreClass; class APIVersionSample extends NxCoreClass{ @Override public int OnNxCoreCallback(NxCoreSystem nxCoreSys, NxCoreMessage nxCoreMsg) { if( nxCoreMsg.MessageType == defines.NxMSG_STATUS && nxCoreSys.Status == defines.NxCORESTATUS_INITIALIZING ) { int version = APIVersion(); System.out.println(String.format("NxCoreAPI.dll version is %d.%d.%d", GetMajorVersion(version), GetMinorVersion(version), GetBuildVersion(version))); // also can do this System.out.println(String.format("NxCoreAPI.dll version is %d.%d.%d", GetMajorVersion(nxCoreSys.DLLVersion), GetMinorVersion(nxCoreSys.DLLVersion), GetBuildVersion(nxCoreSys.DLLVersion))); return defines.NxCALLBACKRETURN_STOP; } return defines.NxCALLBACKRETURN_CONTINUE; } public static void main(String args[]) { APIVersionSample nxCore = new APIVersionSample(); if (nxCore.LoadNxCore("NxCoreAPI64.dll") != 0){ nxCore.ProcessTape(args[0], 0, defines.NxCF_EXCLUDE_CRC_CHECK, 0); } else System.out.println("loading library failed"); } } |
import NxCore tapePath = "" def OnNxCoreCallback(NxCoreSys, NxCoreMsg): if NxCoreMsg.MessageType == NxCore.NxMSG_STATUS and NxCoreSys.Status == NxCore.NxCORESTATUS_INITIALIZING: version = NxCore.APIVersion(); print("NxCoreAPI.dll version is {}.{}.{}".format( NxCore.GetMajorVersion(version), NxCore.GetMinorVersion(version), NxCore.GetBuildVersion(version))); # also can do this print("NxCoreAPI.dll version is {}.{}.{}".format( NxCore.GetMajorVersion(NxCoreSys.DLLVersion), NxCore.GetMinorVersion(NxCoreSys.DLLVersion), NxCore.GetBuildVersion(NxCoreSys.DLLVersion))); return NxCore.NxCALLBACKRETURN_STOP return NxCore.NxCALLBACKRETURN_CONTINUE if NxCore.LoadNxCore("NxCoreAPI64.dll"): returnValue = NxCore.ProcessTape(tapePath, 0, NxCore.NxCF_EXCLUDE_CRC_CHECK, 0, OnNxCoreCallback) else: print("loading library failed") |