01-16-2020 05:37 AM
Hi all,
I have an User Event Refnum. I want to get the reference number of the User Event. When I connect a probe, I am able to see the reference number. But I am unable to get it as an output.
Any ideas regarding how to get the Reference Number as an output.
Any kind of help is highly appreciated.
Thanks in advance.
Solved! Go to Solution.
01-16-2020 05:39 AM
Type cast the ref to an I32?
/Y
01-16-2020 05:53 AM
I don't think typecasting is working.
I have used I32 and the result is coming in negative. But probe output is a positive value.
01-16-2020 05:59 AM
You could also try the Coerce To Type function.
But out of pure curiosity, why do you need the reference number?
01-16-2020 06:07 AM
Hi crossrulz,
I am unable to find the coerce to Type Function .I am using labVIEW 15.
01-16-2020 06:13 AM
01-16-2020 06:29 AM
@Deep33 wrote:
I don't think typecasting is working.
I have used I32 and the result is coming in negative. But probe output is a positive value.
Well that is because a refnum is simply a magic cookie whose actual value has little meaning except to the LabVIEW context in which it was created. And as such LabVIEW tends to prefer unsigned interpretation for such values. So why not typecasting it to an unsigned 32 bit value if you don't want a sign?
Still you haven't answered the reason you want that, the numeric value of a LabVIEW refnum is completely meaningless to anyone but LabVIEW itself and also only in the LabVIEW application context in which it was created. The probe window has to somehow display a value and that is why it shows the numeric value rather than a long string of binary data that the underlaying object may contain to which the refnum refers to. What the actual object data is is totally private to LabVIEW and very different for different refnum classes.
Also there is no way to get at the interna of such refnums as they are not really pointers but magic cookies that refer to the data in a magic, LabVIEW private way.
01-16-2020 06:42 AM
cast it as a U32, not an I32
01-16-2020 07:25 AM
01-16-2020 07:40 AM
Thanks all. U32 is working.
Basically what we are doing is LabVIEW-C interaction.Suppose when we want to speak from C to LabVIEW, C will Generate an user event that is registered in LabVIEW. So to Generate the user event, C has to know the User Event Reference Number.
This is just a brief idea about what we are trying to achieve.
Anyways, Thanks every one for your help.