11-27-2024 04:40 PM
true, on the supplier side its a void function. But in the wrapper I could turn it into an int function or whatever
11-27-2024 04:46 PM
@Steffen01 wrote:
true, on the supplier side its a void function. But in the wrapper I could turn it into an int function or whatever
Now you seem to somehow use contradicting reasoning or something.
First you say LabVIEW can't call a function with a return value as the one provided by your supplier. When I point out that it can, your supplier function suddenly has no return value!
Which is it?
11-27-2024 05:02 PM - edited 11-27-2024 05:03 PM
supplier dll has void functions. But that does not matter to Labview. The wrapper dll talks to the suppler dll. But Labview talks to the wrapper dll. So there could be a different type in the wrapper
11-28-2024 04:41 AM
Just an extra note. You mention C++, and so far you seem to just try to use global functions that are apparently name mangled. That in itself should not pose a problem to call them from the Call Library Node directly. But if you eventually happen to need to interface to classes with virtual functions, you definitely will need a wrapper.
See here for an example of how to deal with that.
11-28-2024 02:25 PM - edited 11-28-2024 02:30 PM
its classes. And for the part that I am interested in by the look of it one needs to bundle 3 of them and the output will be a bundle of max, min and current poins, 90 values all up. But I figured if I have to learn C++ from scratch, I start with adding 2 values as an example.
Supplier code is in C++, they supplied an example program, and a header file. So best bet is to do the wrapper in C++ as well. This will take a long time....
Our guys use Python and asked supplier to program them something. Haha. Supplier uses C++ and Labview, they gave me nothing.
And yes, some basic functions in their DLL I can actually access with the wizzard. See post #4. Pretty useless stuff to me, like units are in SI etc. So I know it works as such. Lucky, the old software with SOAP will be around for another 1 year, so I still got some time....
11-29-2024 01:22 AM - edited 11-29-2024 01:24 AM
@Steffen01 wrote:
its classes. And for the part that I am interested in by the look of it one needs to bundle 3 of them and the output will be a bundle of max, min and current poins, 90 values all up. But I figured if I have to learn C++ from scratch, I start with adding 2 values as an example.
Supplier code is in C++, they supplied an example program, and a header file. So best bet is to do the wrapper in C++ as well. This will take a long time....
Our guys use Python and asked supplier to program them something. Haha. Supplier uses C++ and Labview, they gave me nothing.
And yes, some basic functions in their DLL I can actually access with the wizard. See post #4. Pretty useless stuff to me, like units are in SI etc. So I know it works as such. Lucky, the old software with SOAP will be around for another 1 year, so I still got some time....
You got the important pieces of information AFAIK. It can be taunting of course but if you can work on this in your normal worktime and not as a hobby project, a year should be plenty of time to get this working. Once you got one done, it's mainly a lot of copy and paste and if you feel adventurous you can venture into macro voodoo. It's not trivial but if you have to interface to a lot of similar APIs you can squash a lot of work by spending a bit extra time for smart macros that then can be used to create the nitty gritty details on the fly for the various APIs you need to interface to.
Templates may look tempting when you work in C++, but your API to call from LabVIEW has to be standard C, so you end up having some sort of standard C wrappers around your template wrappers. Usually that is not any improvement.
11-29-2024 02:16 AM
this is only for our testrig, mainly for myself. Just makes my life easier.
I guess I can try, if their header file does not cause too much trouble in my C++ compiler, then next step I try in C. From what I understand I need the header and also the suppliers .lib file so Visual Studio finds the entry points of the function. It would not compile my dlls without having the .lib file. Lots more pain ahead. But essentially I just need to tap into one function to get the results I need. But that function is also the end boss of their functions
11-29-2024 05:19 AM - edited 11-29-2024 05:20 AM
No! If you want to call C++ code you need to use C++. But you want to declare the exported functions in your wrapper as extern “C”.
This tells the C++ compiler to not name mangle the function name and not do any other C++ specific things for that function export.
11-29-2024 06:13 PM - edited 11-29-2024 06:26 PM
suppose that is this, in the header, make sure functions are not mangled. Because it works ok
this is the add friends setting, for future readers
here both functions getting Dll18.dll to add 2 numbers
11-29-2024 09:25 PM
actually there was a mistake, but this works