LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to use Microsoft Visual Basic to Call LabVIEW DLLs That Pass Clusters

I want to call from Visual Basic a fuction from a dll called NIVision.dll.

The function is>>> void LV_Spoke(void *image, void *roi, void *edgeParams,
void *subPixel, int32 process, int32 scanDir, double subSampling, void
*firstedge, void *lastEdges, void *allEdges, void *linesWNoEdges, void
*lineCoordinates, void *err);

My problem is that roi, edgeParams and all the other void declarations are
clusters in labview.
How should I declare this function in VB and how can I pass the arguments?
Should I define a User-type of mine??

Secondly how can I translate unsigned Long (U32) to visual basic?

I know that my question is a little bit boring, but I am new to this stuff.
I would be o
bliged if someone could help me.

Thank you in advance.
Billy Ray
Greece
0 Kudos
Message 1 of 4
(3,228 Views)
Hi Billy Ray -

It is difficult to access clusters with a language that does not support pointers well. We often work around this fact in VB. A good method is to unbundle the cluster into its individual components in LabVIEW before DLLizing it and calling it in another language. Or if you are fluent in VC++, it is super easy to pass clusters that way. I have attached an example that passes clusters from LabVIEW to VC++ and accesses them that way. I also have attached an example that passes a waveform data type from LabVIEW to VB, it might give you a few ideas about how to handle such things.
Both these examples are available for download on our external help site -> www.ni.com/support

good luck
ben schulte
national instruments
Download All
0 Kudos
Message 2 of 4
(3,228 Views)
Hello Billy,
it is easier to create a wrapper dll for the nivision.dll. In this function you have to put all clusters in variants and then it is very easy to access from Visual Basic to it. I have attached a small example where I declared a cluster with string, numeric and array of numeric. Visual Basic automatically creates an array of objects out of it. Now you can acces to it like this ergebnis(0).
Hope this helps.
Regards
Christian Tenhumberg
measX, germany
0 Kudos
Message 3 of 4
(3,228 Views)

The example in the test_arr.zip works fine (after minor modification) also in labview 2009 and VB6. The DLL passes the Variant to VB6, where it is converted.

 

I have a DLL compiled in Labview 2009 which expects a Cluster as input.

Can anyone help how to define the input for this DLL (or Variant) in VB6?

 

(DLL compiled in Labview 2009, cluster of cca 20 elements as input)

 

Thx

Ladislav

 

0 Kudos
Message 4 of 4
(2,592 Views)