LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to use a DLL function which expects std::vector<double>?

Solved!
Go to solution

The naïve way is to write a wrapper which accepts a double* and a length, but I was hoping there was surely a better way.

 

How have you handled this in your code?

0 Kudos
Message 1 of 4
(1,108 Views)
Solution
Accepted by topic author ijustlovemath

Is this .NET or a "classic" DLL?

 

If it's a "classic" DLL I am pretty sure there is no way to natively construct something in LabVIEW that will work.  It's possible to create clusters that mimic structures used as arguments in classic DLLs, but not classes or containers.

 

If this is .NET then there are some methods you can use to create it.  This is a thread about creating a List in .NET, and I imagine a Vector could be created similarly.

0 Kudos
Message 2 of 4
(1,091 Views)

As Kyle said: No way at all to get that implemented for classic DLLs. C++ object interfaces are not only ABI incompatible between compilers, but sometimes even between different versions of the same compiler. It means that mixing and matching libraries that use C++ objects and were created by different compilers is not only not safe but usually doesn't even work. If exception handling is involved too, you can anyhow forget about it.

 

Only C datatypes are reasonably standardized (nowadays, they were not always, for instance Borland C had some different ideas about passing floating point values than what Microsoft did in their Windows 3.1 compilers).

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

It's a classic (C++) DLL. That's unfortunate! Guess I'll have to wrap this one.

0 Kudos
Message 4 of 4
(1,009 Views)