From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

Creating a .dll file from a NI C program in Visual Studio

I have a C program in Visual Studio that reads temperature from DAQs. I wanted to take this c file and put it into a shared library project in Visual Studio. However, when I try to run the program, it gives me 10 errors that look like this:
unresolved external symbol DAQmxCreateTask referenced in function main
I have NIDAQmx.h included in the project so I'm not sure why CreateTask is considered an external symbol. I'm not sure what causes this problem, could anyone help?

 

Thank you!

0 Kudos
Message 1 of 3
(4,940 Views)

 Hello, have  you ensured that the DAQmx.h file is correctly linked?

 

http://digital.ni.com/public.nsf/allkb/5AC8D3322715707E86257260000BBADA

 

Thanks,

Jonathan R.
Applications Engineer
National Instruments
0 Kudos
Message 2 of 3
(4,915 Views)

Do you understand C compilers and linkers? Did you see anywhere the implementation of your DAQmx function? An implementation is unlike a function declaration the actual function body with the code that implements the function. Header files don't normally include any implementation code, but just declarations. So almost everything declared in a headere file is actually extern to the object files whose C source fiiles included the header file but doesn't have C source code that implements those functions.

 

External dependencies are either contained in other object files (that you normally generate in your project from other C source files) or in precompiled libraries (here the NIDAQmx.lib file, which strictly speaking isn't implementing those functions either, but rather small import stubs that link dynamically to the real funciton implementation in the DAQmx DLL).

Rolf Kalbermatter
My Blog
0 Kudos
Message 3 of 3
(4,781 Views)