Go to Post Our team has a forum..... chiefdelphi.com Ok I had to say it. - Mike Martus [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Spotlight this post!  
Unread 07-02-2009, 09:21
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,753
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: Calling C/C++ from LabVIEW

If all that seems daunting, feel free to describe the higher order stuff that you are finding difficult to do in LV. Pretty sure I can help if you'd rather go that direction.

The other things I'll mention about hooking C code to LV is that you need to watch carefully what the parameter types are. It is obvious, but since LV has to trust what you tell it about the types, it is rather blind. If you don't get the number of dereferences correct, either the C code will crash, or LV will crash when it returns to find its memory corrupted. Also, be careful about ownership of buffers. It is possible for the DLL to reallocate the LV arrays, but only if you know the implementation of the LV arrays. Don't assume you can just realloc them, or assume they are vectors, they aren't. It is far better to keep the allocation and resizing and cleanup of a piece in the same component. So, allocate, resize, and free on the diagram only letting the C code read the data, OR do all of these in C and make LV treat the buffer as an opaque type.

If you need knowledge of LV types, alignment, etc, look for the appendix that goes into those details, and of course ask lots of questions.

Greg McKaskle
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Trouble downloading from LabView MikePres NI LabVIEW 9 24-01-2009 08:53
Trouble Downloading from LabView to cRio MikePres FRC Control System 0 15-01-2009 16:17
LabView installation from package from FIRST Skipwich NI LabVIEW 6 04-12-2008 21:26
Calling functions from other documents Kilroy0846 Programming 9 03-02-2008 19:39
Calling C functions from EasyC koenig3456 Programming 4 27-01-2006 16:03


All times are GMT -5. The time now is 21:47.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi