LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

problem with a dll: undefined symbol

I am trying to call a function, GMW_NV_Create() in a third party dll. Here is my call:

//for S2P rebuild the script notes
int decant_packet(int i)
{
char *pszString;
char szQuestion[5];
char szAnswer[5];
struct GMWnv *ptrNv;

ptrNv=GMW_NV_Create();
pszString = strchr (strRealTime[i].szScriptNotes, ':');
strncpy(szQuestion,pszString-3,3);

}

I am getting a link error:

Undefined symbol '_GMW_NV_Create@0' referenced in "superv.c".

I have attached the include file for the dll below:
0 Kudos
Message 1 of 7
(7,033 Views)
Did you include .lib file for that dll?
Also, make sure that dll file is in your project dir or system dir.
Thanks.
CVI 2010
LabVIEW 2011 SP1
Vision Builder AI 2011 SP1
0 Kudos
Message 2 of 7
(7,011 Views)
Yes. I have a lib and an include file. In fact there is another function that I am calling that works just fine.
Here is part of the include file.

int _stdcall GMW_LoadBDE( char *szSysDir, char *szGoldDir, char *szCommonDir, char *szUser, char *szPass );


// create, release & copy name value containers
HGMNV __stdcall GMW_NV_Create();
HGMNV __stdcall GMW_NV_CreateCopy(HGMNV hgmnv);
void __stdcall GMW_NV_Delete(HGMNV hgmnv);
void __stdcall GMW_NV_Copy(HGMNV hgmnvDestination , HGMNV hgmnvSource);

It seems that when I call GMW_LoadBDE() it works fine. I suspect it has something to do with the double __ in front of the stdcall GMW_NV_Create(). What do I do about this?
0 Kudos
Message 3 of 7
(7,009 Views)
The number of underscores infront of the calling convention should not affect this. You can check to see whether the import library (.lib) file you are using exports this particular symbol and whether it is even called that. You can use dumpbin ( a Visual Studio command line utility) to see which symbols are exported and what their names are. You can pipe the output of this utility to a text file and search the text file for the missing symbol, i.e _GMW_NV_Create@0. The stdcall calling convention always prefixes function names with an underscore. If you cant find this symbol, means its not being exported. Or the name might have been mangled to something else.

Try changing the Default calling convention of CVI to stdcall from the Build options.

How is this functions defined in the header? I didnt see the header file in your post.
Bilal Durrani
NI
0 Kudos
Message 4 of 7
(6,996 Views)
Well this may be the issue. I took a look through the import lib I was using and I did not find GMW_NV_Create. So perhaps I am using an invalid import lib. I did find the GMW_NV_Create in the dll itself. How can I build a new import lib from the dll?
0 Kudos
Message 5 of 7
(6,966 Views)
Open the header file for the dll in CVI, go to Options >> Generate DLL Import Library. CVI will prompt you for the dll and then create an import library for you.

Hope this helps
Bilal Durrani
NI
0 Kudos
Message 6 of 7
(6,956 Views)
That did it! Thanks
0 Kudos
Message 7 of 7
(6,934 Views)