07-29-2009 02:59 PM
Using LabWindows/CVI. I'm trying to be compatible with legacy code, so this isn't the best way to do things but it saves me some headaches.
I have one project/.dll called "GlobalBlock" that contains certain parameters used widely throughout the program. The whole program consists of multiple dlls, for encapsulation purposes.
GlobalBlock.c contains:
struct menu_sdef G_setprefs =
{
//... stuff
};
struct sys_fileheader_sdef Level1Version =
{
//... more stuff
};
struct sys_flags_sdef G_sys_flags;
Solved! Go to Solution.
07-29-2009 03:07 PM
Sorry, hit the wrong button.
GlobalBlock.h contains:
#ifndef __GlobalBlock_C__
extern struct menu_sdef G_setprefs;
extern struct sys_fileheader_sdef Level1Version;
extern struct sys_flags_sdef G_sys_flags;
...
#endif
When I compile the second dll, Plots.c, the C code for which contains something like
#include "GlobalBlock.h"
...
G_setprefs.X = 1.23;
I get :
"undefined symbol '_G_setprefs' in Plots.c
"undefined symbol '_G_sys_flags' in Plots.c
The Build option to include the .h file in the library is set.
I've searched the forums and the help files, and can't find any indication that I should be doing anything different.
07-30-2009 03:46 AM
In the dll that owns the variable, use the _export qualifier on it. This will ensure that it is placed in the dll interface list. In the application (dll or otherwise) that wants to reference this variable, use the _import qualifier on it. This tells the system to use the associated import library that comes with the dll, in order to resolve the references at run time.
JR
07-30-2009 12:40 PM
Thanks much.
Paul