Jump to content

C++ object call from LabVIEW


Recommended Posts

Hello,

I have been using LabVIEW for nearly 10 years but I have to admit I am a little stuck.

I have to use several VC++ DLLs from LabVIEW 2009.

I have no choice than using those DLLs as the code is very large and there is no time to revert back to LabVIEW only.

I have found a good article about calling C++ using a C wrapper at http://labviewwiki.org/DLL/shared_library

I was wondering if someone had done something where instead of calling a double it would be an object.

Any help would be welcome.

Many Thanks,

Christophe

Link to comment

Hello,

I have been using LabVIEW for nearly 10 years but I have to admit I am a little stuck.

I have to use several VC++ DLLs from LabVIEW 2009.

I have no choice than using those DLLs as the code is very large and there is no time to revert back to LabVIEW only.

I have found a good article about calling C++ using a C wrapper at http://labviewwiki.o.../shared_library

I was wondering if someone had done something where instead of calling a double it would be an object.

Any help would be welcome.

Many Thanks,

Christophe

The only DLL calls I've had to make to C++ all involved a C interface where I just needed to pass the pointer to the class (which LV can easily hold onto in a uInt32 or a uInt64 as long as LV isn't expected to access the data of the object directly). I'm sure there is a solution if the interface is actually a C++ exported function, but I don't know what it is. This may be a question better posted on NI.com/forums pages. The AEs there get questions about DLL calls all the time and may have a ready answer for you. No promises, but I'd suggest trying it.

Link to comment
  • 2 weeks later...

The only DLL calls I've had to make to C++ all involved a C interface where I just needed to pass the pointer to the class (which LV can easily hold onto in a uInt32 or a uInt64 as long as LV isn't expected to access the data of the object directly). I'm sure there is a solution if the interface is actually a C++ exported function, but I don't know what it is. This may be a question better posted on NI.com/forums pages. The AEs there get questions about DLL calls all the time and may have a ready answer for you. No promises, but I'd suggest trying it.

Calling C++ functions gets nasty if you have several variants of the same function with different parameters since you have to figure out which decorated function name you want to access for a particular parameter version. And the decoration while logically corresponding to the parameter list, is anything but easy to decipher (and varies between C compilers too).

Accessing methods and member elements of objects will only be doable with C wrapper interfaces though.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.