LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Creating CINs or Shared Libraries with a console application in C++

I posted a similar message to this not so long ago but I think it may have been misinterpreted.
 
I have wrote a genetic algorithm using microsoft visual C++ 6.0. This genetic algorithm consists of a console application (i.e. to begin with a static link library of about 15 different source codes is created, then this static link library is used dependant on an evaluation function which is solved). I am trying to link this genetic algorithm to LabVIEW but i) I need to pass values into the genetic algorithm, ii) I need to read values from the static link library for further development of my code.
 
I have begun learning how to set-up and use a dll but that has only been done using 1 source code, and I am having problems setting up CINs on my machine for some reason.
 
Is what I am trying to do possible, or would it just be easier to set up the GA totally in LabVIEW and use individual pieces of source code from C++ in dll's so that the LabVIEW VI computes my tasks?
 
Thanks
 
Alan Homer
0 Kudos
Message 1 of 4
(2,742 Views)


@alanhomer wrote:
I posted a similar message to this not so long ago but I think it may have been misinterpreted.
 
I have wrote a genetic algorithm using microsoft visual C++ 6.0. This genetic algorithm consists of a console application (i.e. to begin with a static link library of about 15 different source codes is created, then this static link library is used dependant on an evaluation function which is solved). I am trying to link this genetic algorithm to LabVIEW but i) I need to pass values into the genetic algorithm, ii) I need to read values from the static link library for further development of my code.
 
I have begun learning how to set-up and use a dll but that has only been done using 1 source code, and I am having problems setting up CINs on my machine for some reason.
 
Is what I am trying to do possible, or would it just be easier to set up the GA totally in LabVIEW and use individual pieces of source code from C++ in dll's so that the LabVIEW VI computes my tasks?


First CINs are a legacy technology and not recommended for new work.

You could do what you want but it is a bit involved. Either you have to edit the LabVIEW make files that come in the cintools directory or setup your Visual C environment accordingly to include all the source files and link them into the temporary DLL before the lvsbutil tool is invoked to turn them into the CIN resource.

The much more straight forward way would be to actually create a DLL from your functions and then using the Call Library Node call the according functions from that DLL with the necessary parameters. And it happens to be the case that developing the entire algorithme in LabVIEW would probably work just as well but this of course might be an issue with development time depending on how complicated those algorithmes are.

Rolf Kalbermatter



Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
Message 2 of 4
(2,715 Views)
I agree with Rolf.  CINs do allow you to link some C code in directly, but it is old technology.  I believe that LabVIEW 8 does not support all types of CINs that were able to be used in previous versions, in that your CINs now have to be self-contained and cannot call external libraries (or something to that effect).  A DLL or a complete LabVIEW port would definately be the way to go.

-tuba
0 Kudos
Message 3 of 4
(2,688 Views)


@tuba wrote:
I agree with Rolf.  CINs do allow you to link some C code in directly, but it is old technology.  I believe that LabVIEW 8 does not support all types of CINs that were able to be used in previous versions, in that your CINs now have to be self-contained and cannot call external libraries (or something to that effect).  A DLL or a complete LabVIEW port would definately be the way to go.

-tuba


What you are refering to are probably external code resources. That is a special form of CIN that could be referenced by normal CINs  but resided on disk as separate file so that multiple CINs could use the same external code resource. Creation of external code resources was discontinued with LabVIEW 6.0 if I'm not mistaken but you could still use old CINs that used them. Since the current LabVIEW platforms (except Windows 32bit) are more or less all from LabVIEW 6  or later origine you could consider external code resources silently faded out.
Possibly NI removed the old support code to load external code resources in LabVIEW 8 which would be what you are refering to. Not having created an external code resource ever (but virtually hundreds of CINs) I wouldn't really care about that 😉

Rolf Kalbermatter
Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
Message 4 of 4
(2,684 Views)