Would it be possible to post your code for the example shown? I've studied the linkyou referenced and while it's very similar to your example, it's not quite the same. It would be helpful to see how it's done with numerics rather than strings. I'm pretty new to callbacks and all the information I can get would be helpful.
Since I know very little C I thought it would be helpful to see the C code (the LV part is completely obvious to me). I'm sure what you said would be totally obvious to someone intimately familiar with such procedures, but not me. Since this is a fairly unique application there's not a lot of other places to look for information. There are several things being setup in the LVUserEvent example and I'm not sure which of them need to change for a different data type.The MixeCluster example in another thread probably explains some of what I need - and I'll study it some more, but the added complexity of the cluster adds another layer of confusion that I don't need right now.
The Create User Event function node has an input called "user event data type". This is were you define the datatype of the associated data element that goes with the event. This data type has to match the data type you pass to PostLVUserEvent, otherwise bad things happen.
If you want to have an idea how the declaration of the data parameter to PostLVUserEvent() should look like you can wire the according data element (numeric, string, cluster) to a Call Library Node whose parameter is set to Adapt to type. Now right click on the Call Library Node and select "Create C file", If you now look inside the created C file you will see the C datatype to use to match the actual LabVIEW datatype exactly.
If skalar datatypes (floats, integers) already pose problems to you, you should maybe find someone who can do this part of the project for you. Callback functions are not exactly beginners stuff for C programmers. There are many pitfalls and trouble ahead that go definitly far beyond understanding the basic C datatypes.
I was just wondering if it is also possible to use the PostLVUserEvent with LabVIEW Exes running with the RunTime?
I just now looked into the examples and saw that a reference of the user event is passed to the dll. So it should also work in an exe.
I am not sure so far if I can use this approach in my problem. Is it also possible to send events to a LabVIEW exe from a dll, when the dll is not called from the LabVIEW exe?
Is this an effective way to transport data between LabVIEW and other processes? I was thinking about using this mechanism to send data from a dll data acquisition process to a LabVIEW exe.
I am trying to pass a Cluster back through LVPostUserEvent, as a C Struct. The struct/cluster is just a string and a double. I have gotten the string to be correctly handled, but the double is just coming through as random garbage. I tested it with just a double being passed back through LVPostUserEvent, and it worked just fine on the labview side, the event was posted fine and no garbage. I then tested it with a cluster of an int and a double, and they both are garbage. Do you have to treat each element as a handle, and call DSNewHandle for each element? I understand why arrays and strings have to inform the memory manager, but do a simple int or double need to as well?