LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with using DLL functions

Solved!
Go to solution

Hello.

I am trying to write a DLL that calls functions from a camera DLL and wraps them up and passes them on to LabView. I have written some practice code and DLLs to successfully pass functions and events to and from Labview and LabWindows/CVI DLLs so I like to think that I have a reasonable grasp on what I am trying to do. However I keep getting errors with calling functions from the camera DLL functions I want to use in my DLL.

I have two functions in the camera DLL, XC_AddImageFilter and XC_RemImageFilter, that I wish to wrap up and make available in my DLL. When I compile I get the following errors:

 2 Project link errors, Undefined symbol "_XC_AddImageFilter" referenced in "ImageFilter.c". Undefined symbol "_XC_RemImageFilter" referenced in "ImageFilter.c".

I have tried altering the prototypes in my header file and changing the functions slightly but nothing I try seems to work. I have linked the camera DLL to my project in the way that was previously successful with other practise DLLs and I have scoured this forum for simmilar problems but I cannot seem to find a soloution.

Thank you for taking the time to read this. I hope you will be able to help me with my problem.

PS I was having problems attaching my code so I put a .txt extension on the end and apparently that worked so please forgive the dodgey file extensions.


 

Download All
0 Kudos
Message 1 of 9
(4,783 Views)

Those appear to be link errors, not compile errors.  Does your DLL compile without error?

 

If you're only seeing linkage errors and not compile errors then the problem would most likely be with the camera DLL's import library not getting linked to your DLL.

 

I.e. I suspect it's not a problem with your DLL or how you're exporting your DLL functions, it's a problem with getting linkage to the camera DLL from yours.

 

Are you including the camera DLL import library in your DLL's project? XCamera.lib?

 

There is a way to invoke DLL functions without an import library (by DLL function ordinal) but almost certainly there's a .lib file provided with the camera DLL that you can use to bind it to your DLL.

 

0 Kudos
Message 2 of 9
(4,770 Views)

Thank you for the swift reply 🙂

There was an xcamera.lib file that I had not included.

Thanks for pointing that out. Unfortunately it still gives the exact same errors.

If I remove the camera function calls then my DLL compiles fine.

Any other suggestions please? 

0 Kudos
Message 3 of 9
(4,767 Views)

Looking at the xcamera.h header file, it looks like it's set up to switch hit as a C++ or a C interface.  You need to make sure you're using the "C" names for the functions and that the .h file is set up to compile for C, not C++.

0 Kudos
Message 4 of 9
(4,749 Views)

OK So I now have a compilable dll but I wish to extend it's functionality and have encountered some rather ironic problems.

I am trying to send events into labview from my dll. There is an example of this on the NI site somewhere and I have implemented by itself with no problems.
I have just pasted in the working code I wrote into my new dll and am now getting Project link errors again! I am using the Labview excode.h to access the
"PostLVUserEvent"  and "DSNewHandle" functions as well as a few others. However, it's these two that are comming up with the errors "Undefined symbol _PostLVUserEvent" etc..

Any thoughts or tips would be gratefully received!

Thank you.

P.S. In case anyone stumbles upon this in the future searching for simmilar problems here is how I fixed the original problems I was having:

I fixed it by making sure that the dll was only exporting my new dll functions and not any of the include libraries etc. This can be found under Build > Target Settings >Exports.
I also made sure that my functions were wrapper functions that were of the same type (i.e voind, unsigned long, etc..) as the functions I was trying to call from the dll. Also that the functions I was
trying to call were the returns of my wrapper functions. In the case of the function with the type void I had get rid of the word "return" and just have it implicitly return the function in order for it to compile.

0 Kudos
Message 5 of 9
(4,695 Views)
Solution
Accepted by topic author T2004

Sorry!

I didn't include the Labview.lib file which is why the Labview functions weren't working! Duh!

#begginer errors!

0 Kudos
Message 6 of 9
(4,689 Views)

Hello everybody,

 

I am trying to call DLL into my labview code. but  i think I have problem with some header file. Actually I don't know what was wrong.

I found some source code that perform scan matching algorithm (named ICP) for SLAM. Also it has DLL. The codes are written in the Visual C++ and imported into matlab by DDL.

But I want to load that DLL into Labview however there are some thing wrong. I think some of header file or.. are missing.

I hope you will be able to help me with my problem. I attached that codes. Please see them please

0 Kudos
Message 7 of 9
(4,597 Views)

Hello,

I´m programming the MSP430 gang-programmer of TI, with the demo of labview that was install with the gang programmer. When I am charging my code to the device, the labview interface (the dll file) prints me an error. This is what it says: ERROR: Verification failed!

I put the GANG430.INI and GANG430.dll files in the correct path, but it doesn´t work. Can someone help me please??

0 Kudos
Message 8 of 9
(3,918 Views)

Hello, since you are working in LabVIEW you will have more success posting to the correct board.

 

Additionally, it's better not reviving old threads to post non strictly related questions: open a new discussion linking the old one instead.

 

 

 

** Edit **

I see you have already posted there.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 9 of 9
(3,910 Views)