LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

C program calling dll made in Labview7.1

Hi all

 

i made a program in labview and the made its DLL using application builder.Now when i want to use the DLL in C program,my program is compling but while building it the error comming is  Unresolved external '_SETINS' referenced from D:\dhiraj\labread.OBJ. SETINS is the function name i am calling.

 

Moreover i also want to know that is there someway to provide character string output from the DLL made in Labview.

 

Also if the parameter which i am passing as arguments to the DLL and then in DLL i am changing the argument value,then when i come back after the DLL call ,what will be the value of the arguments??.Will it change or remain the same.

 

 

Thanks in Advance for early reply.....

 

 

Dhiraj Kumar

0 Kudos
Message 1 of 12
(4,099 Views)

Hey Why is someone not attending to my problem,maybe i feel labview DLL's can't be used in any language.Its not being recognized by the C++.

 

Oky let me make it simple.

 

Let us make a DLL with  C=SUM(A,B) where (C=A+B)

now how to use the DLL in any orther language and use the function SUM.

 

Hoping This time someone replies

Thanks in Advance

 

Dhiraj Kumar

0 Kudos
Message 2 of 12
(4,061 Views)
I think you need to set "C Calling Convention" while building the DLL in LV...
- Partha ( CLD until Oct 2027 🙂 )
0 Kudos
Message 3 of 12
(4,056 Views)

Hi,

 

"Moreover i also want to know that is there someway to provide character string output from the DLL made in Labview."

 

while using string output from dll create a string array and pass to dll, while building dll (with string output) an extra parameter named len will be created input string array size to this parameter

 

Assumptha

Message 4 of 12
(4,052 Views)
Assumptha, you can use the "Quote" option seen on the top-right corner, instead of copy-pasting the original reply. Smiley Happy
- Partha ( CLD until Oct 2027 🙂 )
0 Kudos
Message 5 of 12
(4,050 Views)

Ok Partha! but copy paste is convinent for me! Smiley Wink

 

regarding calling labview buld dll from following link will also be help full

 

http://zone.ni.com/devzone/cda/tut/p/id/3927

 

 

Regards

Assumptha

 

Message 6 of 12
(4,046 Views)

dhiraj03416 wrote:

Hey Why is someone not attending to my problem,maybe i feel labview DLL's can't be used in any language.Its not being recognized by the C++.

 

Oky let me make it simple.

 

Let us make a DLL with  C=SUM(A,B) where (C=A+B)

now how to use the DLL in any orther language and use the function SUM.

 

Hoping This time someone replies

Thanks in Advance

 

Dhiraj Kumar


When you build your DLL in LabVIEW, LabVIEW also creates a .h file and a .lib file. The H file you obviously have figured out already needs to be #included in your source file where you want to call the function. This allows the compiler to create code to call that function correctly. However the linker has no idea where to get that function from and that is where the .lib file comes into the play. You need to add that lib file to your project too, so the linker can resolve the function call properly.

 

A little bit of C programming basics also includes some basic knowledge about linking the program together and that you need to have all functions available in either an object or library file, somewhere

 

And last but not least the lib file only contains the code to look for the function in the according DLL file, so in order to run your application afterwards you need to make sure to copy (and distribute) the DLL into your executable directory.

Message Edited by rolfk on 10-30-2009 01:32 PM
Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
Message 7 of 12
(4,032 Views)

some one can help me with the code in borland C++ 5.1

 

0 Kudos
Message 8 of 12
(3,992 Views)

dhiraj03416 wrote:

some one can help me with the code in borland C++ 5.1

 


Borland C or Visual C shouldn't matter much. Only the configuration location and names will be a little different. That happens even between different versions of Visual C.

 

But what is your problem? Probably the linking of the LabVIEW provided *.lib file? Unfortunately Borland uses OMF format object libraries while Visual C uses the COFF format. And the standard LabVIEW link libraries that you receive are of course COFF format. There are also OMF format libraries that you can regognize from the *.sym.lib ending, but they are for the now obsolete Symantec C compiler. But while both Symantex C and Borland C use OMF, object library formats are not always the same eventhough they use the same basic format type. I have several times recommeneded here to try to use the Symantec libraries for use with the Borland C compiler with the warning that it might NOT work. And never received any feedback positive or negative. That is the general type of feedback one receives here on possible solutions Smiley Mad hint, hint!

 

IF it doesn't work you have two options: Change the compiler or load all the functions you need dynamically! (LoadLibrary(), GetProcAddress() ).

Message Edited by rolfk on 11-03-2009 07:41 AM
Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
Message 9 of 12
(3,983 Views)

Thanks dear

 

Yes that's the problem i am facing,

Ok i am loading the dll's dynamically ,then also i am not getting the results.when i give the Message Box ,then its still holding.

Using dynamic loading method do i have to include any file of labview???

 

 

Thanks alot for attending to my problem.

 

 

0 Kudos
Message 10 of 12
(3,970 Views)