03-22-2010 08:24 AM
Yes, I found all those links, but I haven't how to actually use the PostLVUserEvent() function. In all the examples I've found so far regarding callbacks noone is actually using that function. I tried searchin in the NI directory for the function, but again couldn't find it. My LV help shows nothing about it. Is it an obsolete function?
George
03-22-2010 08:37 AM
This is the link to the 2009 help so it is definitely not obsolete.
This is a code example how to use this function.
This is a lengthy thread that discusses all kinds of gotchas and wathcouts about the function and also contains some sample code.
That is only from the first two pages of the 40 links. I think that should suffice to show you that there IS information, and actually useful too. You just have to read it, digest it and understand it.
03-22-2010 09:06 AM
Thanks Rolf. Sorry to be a pain. I know very little about C and am struggling to learn about this callback thing as fast as I can. I had studied all the examples in those links, but now I found where PostLVUserEvent is called in the second link. I couldn't figure out how the C code knows anything about PostLVUserEvent, but I found it in extcode.h. I think the "Using External Code in LabVIEW" document will also be useful.
George
08-28-2011 02:29 PM
________________
LabVIEW does not know pointers and certainly not function pointers. What you should do instead is writing a C DLL that implements the callback and also exports a function to be called by LabVIEW that translates between the callback and a LabVIEW user event.
________________
I read this post for LV 8.6. Just wondering if the approach for implementing callback in LV2010 is the same or anything changed?That is write a C DLL that implements callback and export function which can then be called by LabVIEW.
08-28-2011 10:13 PM
@lvrat wrote:
I read this post for LV 8.6. Just wondering if the approach for implementing callback in LV2010 is the same or anything changed?That is write a C DLL that implements callback and export function which can then be called by LabVIEW.
There are no changes from 8.6 to 2010 that would allow you to write a callback function in LabVIEW that could be called directly from C. You'll still need to write at least a minimal C DLL, which either responds directly or calls PostLVUserEvent() to cause LabVIEW to respond.
08-29-2011 12:34 AM
@lvrat wrote:
I read this post for LV 8.6. Just wondering if the approach for implementing callback in LV2010 is the same or anything changed?That is write a C DLL that implements callback and export function which can then be called by LabVIEW.
Yes it's still valid and will most likely remain valid for quite some time in the future.
07-01-2017 02:21 AM
Dear Alejandro,
do you solve your problem? And could you puplish your Solution?
07-01-2017 07:18 AM
@HallmannSVS wrote:
Dear Alejandro,
do you solve your problem? And could you puplish your Solution?
He may have solved it. He probably doesn't read this forum anymore as the last time he logged in here was in September 2011. And even if he would read this post he may not be allowed to share the code as it was probably developed for his employer.
07-02-2017 10:38 AM
Dear Mr Kalbermatter
do you have an example for a dll within a callback function,and a wrapper dll as a interface for Labview and the dll? of course yes
are you allowed to share this c-code, VI?
07-02-2017 02:49 PM
I don't have a ready made example from actual projects that I could share but there are many poists on this site, some from me too, which detail the process more clearly.
http://forums.ni.com/ni/board/crawl_message?board.id=180&message.id=63133
http://forums.ni.com/ni/board/crawl_message?board.id=170&message.id=967665
http://digital.ni.com/public.nsf/allkb/89165ede5031c68686257b2e0006fe99
http://forums.ni.com/ni/board/crawl_message?board.id=170&message.id=893812
http://www.ni.com/example/26480/en/
It's a lot of information and it's certainly not an easy topic.C function pointers are an advanced programming feature that even many C programmers struggle with. Adding to that the interfacing to an image acquisition library only makes it more daunting. And then LabVIEW which has its very own requirements.