> Sorry to be a bit thick, but what exactly do I need to do?! The
> function prototype in my dll is:
>
> void __cdecl VisaTest(LVRefNum *VISAResourceName);
>
No need to apologize, I just didn't know how much detail to go into.
A LVRefNum is just four bytes. It looks like this test function returns
you a refnum in the variable VISAResourceName. When I was telling you
that you could just use an integer, I wasn't aware that LVRefNum is
defined in extcode.h. There it pretty much tells you that it is a
Private reference.
I'm not sure if there is anyway to reuse extcode.h, probably not, but
you could easily make an equivalent definition. Something like...
typedef LVRefNum int;
LVRefNum visaRef;
VisaTest(&visaRef);
Nex
tFunction in DLL(visaRef);
OR
NextFunction in DLL(&visaRef);
If the NextFunction can modify the visaRef, it will need to be given a
reference to the value. If it only looks at the value, the first on
will work. At this point, the compiler will help keep you honest as the
functions will either take a LVRefNum* or an LVRefNum.
> Since a LVRefNum is the resouce name with some extra info wrapped
> around it (I think) won't it be bigger than an integer? I tried
> sending a pointer to an integer and got a memory access error! Do I
> need instead to extract the integer representing the name from the
> VISA resource name in LabView, return that to Java and send it into
> the next VI, where it's converted back to a VISA resource name?
>
I'm sorry I can't help much with the brewing of the JAVA code, but a
LVRefNum is just four bytes, and you won't get a memory access error
unless you try to dereference the refnum. It isn't a TRUE pointer, but
a synthetic pointer that LV can use
to do some checking and associate it
with your VIs.
Hope this helps.
Greg McKaskle