LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

DLL exported functions now missing leading underscore???

I have a DLL that I've written which contains functions intended for use with a custom TestStand step type.  Here is an example prototype:
 
void __declspec(dllexport) TX_TEST RfSwConnectConfig(tTestData *testData, tTestError *testError) ;
 
The problem is that the names of the exported functions changed in the most recent build of the DLL.  They were originally exported with a leading underscore, such as _RfSwConnectConfig.  Now the underscore is missing, RfSwConnectConfig.  I can't seem to find any compiler options which would control this.  The new builds are occuring on a different computer, so the environment is not the same.  I'm currently using LabWindows/CVI 7.1.  I can update my TestStand scripts to call either way, but would like to ensure that all future builds export the same function names.
 
Thanks 
0 Kudos
Message 1 of 5
(4,591 Views)
My guess would be that the two machines are in different compatibility modes. Functions compiled in Visual C/C++ mode will have a prepended underscore while those compiled in Borland C/C++ mode will not. To check this, go to Options...->Build Options...->Compatibility with:.
 
-alex
0 Kudos
Message 2 of 5
(4,570 Views)
Both machines were set up in Visual C/C++ mode.  I have since realized that the last build that prepended underscores to the function names occured on the computer I'm currently using. 
 
Brief timeline:  Build 1 on computer A prepends underscore, Build 2 on computer B prepends underscore, Build 3 on computer B does not prepend underscore.
 
Any other ideas?
 
 
 
0 Kudos
Message 3 of 5
(4,545 Views)
Hello

I understand that you are using a c++ compiler.  CVI is pure C, so you must define all your functions as C functions to avoid c++ compiler decoration.

Example:
In the cpp file...
#ifdef __cplusplus
{
#endif

void MyFunction (void)
{
    return;
}

#ifdef __cplusplus
}
#endif

And in the h file...
#ifdef __cplusplus
{
#endif

void MyFunction (void);

#ifdef __cplusplus
}
#endif

Good luck
Carlos Arcediano del Amo
0 Kudos
Message 4 of 5
(4,533 Views)

None that I think are very likely. I guess tell me a bit more about your application. How do you export symbols; by using a header file or by using __declspec(dllexport)? Are the builds with/without underscores reproducable in some pattern, or does the result seem to be random? What if you delete the cvibuild directory to force everything to recompile; do you see consistent behavior then? Do you see this behavior with all projects or just this one? If it's just this one, you can try recreating the project file (just make a new project and add the files from the old one to it).

Let me know,

-alex

0 Kudos
Message 5 of 5
(4,526 Views)