03-10-2010 03:28 PM
Hi, folks!
I develop my apps writing in C, using MSVC (not Measurement Studio/C++). I use LabWindows to design the UI and use the external compiler support to generate the UI's object file, which I link into my program. I've had great results doing this; I link to the appropriate .lib and the corresponding .dll is in the apps root folder.
However, I'm unable to get this to work for using the NiReport library. I'm trying to build the nirsample app which came with my LabWindows installation but the link step fails because it cannot find the exported functions required (NI_Report_xxx).
There is a utility that comes with the MSVC installation called Depends, which allows one to view the imported and exported fuinctions in a .dll file. When I load up the NiReports.dll, it only exports four functions: DllCanUnloadNow, DllGetClassObject, DllRegisterServer and DllUnregisterServer. Where are all the NI_Report_xxx functions? I think if I can find the proper .dll, I'll be successful in building my app and will be able to go on with my life...
Thanks in advance for any help.
[update]
I'm almost there! I'm using nirsample.c and nireport.obj in my test compile and it returns a link error saying it it has an unresolved external symbol, _StrDup@4. Ok, I know that StrDup is a function found in the CVI_Toolbox and I've included that in the libraries used to link against. I had a similar problem using the Excel automation functions and was able to get around it by including the source file, excel2000.c. So, if I could just get hold of the source for nireport.obj, I think that would solve my problem. However, unlike most of the other toolbox extras, this one does not include its source.
[/update ]
'til next we type...
HAVE FUN!! -- Jesse
03-11-2010 06:07 PM - edited 03-11-2010 06:08 PM
Hi Jesse,
You'll need to make the following changes to your project:
03-12-2010 11:09 AM
Michael,
Thanks for the quick response. A long time ago I rebuilt Toolbox as a dll; it works fine that way for all my other projects until this one. However, I tried your suggestion and it led to another error:
--------------------Configuration: NirSample - Win32 Debug--------------------
Compiling...
toolbox.c
c:\program files\microsoft visual studio\vc98\include\windef.h(252) : error C2371: 'HINSTANCE' : redefinition; different basic types
g:\extlib\include\cvidef.h(144) : see declaration of 'HINSTANCE'
Error executing cl.exe.
NirSample.exe - 1 error(s), 0 warning(s)
My guess is this is because of a conflict in how the various include files are being loaded and I'm not sure how to fix that. (I do not have that problem when using toolbox as a dll for my other projects.)
For the sake of completeness, I've attached the MSVC project file (nirsample.dsp) so you can see how I've got this set up. Oh, and I'm using MSVC 6.0 for coding and LabWindows 6.0 for ui design. (I don't have a CVI2009 directory.)
Jesse
p.s.: Your website won't let me upload the dsp file (the file extension is not valid), so I've renamed it NirSample.txt
03-12-2010 05:23 PM
Hi Jesse,
It appears windef.h doesn't have a macro to protect redef of HINSTANCE. So if you make use of it, make sure you declare it before all other header files as they have redef protection.
Cheers,