01-05-2017 06:46 AM - edited 01-05-2017 06:51 AM
Hello,
I'm using CVI2013 on Win7.
I have a DLL project proj1.dll where I declared a function "GetExxotestList" like this :
int __attribute__((overloadable)) GetExxotestList (int *NbCardUSB, int *NbCardPCI, struct DEVICE *Device[8])
DEVICE is a struct declared in the same .c file like this :
struct DEVICE { unsigned long d; .... };
In the .h file of this project, I declared only the function prototype like this :
int __attribute__((overloadable)) GetExxotestList (int *NbCardUSB, int *NbCardPCI, struct DEVICE *Device[8]);
And I compile it with no errors.
Now, in the Main project (executable) I wanted to call this function inside a callback function, so I did like this :
int CVICALLBACK Refresh_Exxotest_Panel_CB (int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { int NbExxoCardUSB = 0; int NbExxoCardPCI = 0; struct DEVICE *Device[8]; switch (event) { case EVENT_COMMIT: //Update exxotest list GetExxotestList (&NbExxoCardUSB, &NbExxoCardPCI, Device[8]); break; } return 0; }
In the Main project, I added the .lib and .h files of the dll project.
The problem is when I try to compile the Main, I have this link error :
error: Undefined symbol '__Z15GetExxotestListPiS_PP6DEVICE' referenced in "c:\ProjectX\Sources\Main\cvibuild.Main\Debug\Main.obj".
I can't undrestund why !
What is weird too, is that "Z15" and "PiS_PP6" labels are added automatically in the error message, I don't know what is it.
Please advice,
best regards,
Houssam
Solved! Go to Solution.
01-06-2017 03:33 PM
Hi Houssam,
You need to define the struct definition in the header file so that the external code module, or your main program can see that struct definition.
01-09-2017 03:06 AM
Hello RoxtheFox,
Thank you for your reply.
Puting the struct declaration in the header file is a good idea, but not enough.
I had to change the function declaration, in the header file like this :
int DLLAPI __stdcall GetExxotestList (int *NbCardUSB, int *NbCardPCI, struct DEVICE *Device[8]);
and in the .c project file like this :
int __declspec(dllexport) __stdcall GetExxotestList (int *NbCardUSB, int *NbCardPCI, struct DEVICE *Device[8])
Now I can compile without error.
Have a nice day !
04-05-2018 04:32 AM
Hello houssam;
i have the same probleme when i compil without error but whene i debug i have this error i dont know why im using labwindows cvi 2017
error :
Build Status (OCR.prj - Debug)
Link OCR Example_dbg.exe
error: Undefined symbol '_DisplayError' referenced in "c:\Users\i87278\Desktop\OCR exp\cvibuild.OCR\Debug\OCR.obj".
Build failed.
do you have any idea of this problem
thks
04-05-2018 04:55 AM - edited 04-05-2018 04:56 AM
Hello Rose,
You may have to change the function declaration of "DisplayError" as I did.
If this function is declared in another project, make sure that you included the header file (.h) and the object (.lib) in the OCR project.
04-05-2018 07:03 AM
Hello,
i include all the floder header but there are no object .lib what is it exactly
thks