thenoob94 Posted April 19 Report Share Posted April 19 os: Debian I've written a c Function and compiled it to a shared object. I call the function in labview and it executes just fine. The function modifies a ".cti" file. When I want to execute the function a second time it fails because labview still takes ownership of the process even after it terminates. When I run the function without labview this error doesn't occur.. This is my function: extern "C"{ int InitSDK(); } int InitSDK() { string ctiPath; string genicamPath; string genicamCachePath; string clProtocolPath; #if defined (WIN32) char buffer[1024] = { 0 }; int res = GetEnvironmentVariableA("GENICAM_GENTL64_PATH", buffer, sizeof(buffer)); if (0 == res) return false; ctiPath = string(buffer); memset(buffer, 0, sizeof(buffer)); res = GetEnvironmentVariableA("SVS_GENICAM_ROOT", buffer, sizeof(buffer)); if (0 == res) return false; genicamPath = string(buffer); memset(buffer, 0, sizeof(buffer)); res = GetEnvironmentVariableA("SVS_GENICAM_CACHE", buffer, sizeof(buffer)); if (0 == res) return false; genicamCachePath = string(buffer); memset(buffer, 0, sizeof(buffer)); res = GetEnvironmentVariableA("SVS_GENICAM_CLPROTOCOL", buffer, sizeof(buffer)); if (0 == res) return false; clProtocolPath = string(buffer); SV_RETURN ret = SVLibInit(ctiPath.c_str(), genicamPath.c_str(), genicamCachePath.c_str(), clProtocolPath.c_str()); #elif defined(__linux__) ctiPath ="./"; SV_RETURN ret = SVLibInit(ctiPath.c_str(), NULL, NULL, NULL); #elif defined(__APPLE__) && defined(__MACH__) ctiPath = "/Library/Frameworks/SVGenSDK.framework/Versions/2.5.8/Libraries/cti"; SV_RETURN ret = SVLibInit(ctiPath.c_str(), NULL, NULL, NULL); #endif if (SV_ERROR_SUCCESS != ret) { printf("SVLibInit Failed! :%d", ret); return -1; } printf("Init worked \n"); return 0; } Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.