AnsweredAssumed Answered

vrf Importing DLL's, passing by reference

Question asked by VRFuser on Aug 18, 2004
> int __stdcall C843_qVST(int iId, char* *szAxes, char* *names, int maxlen);

Oh my! Watch that. Are you *sure* it's "char* *szAxes" etc? I'm sure it's
likely... as the names imply plural. That's a string array.

> 1.  How do I create that in VEE?

Check the documentation for C834_qVST and see how exactly these arrays are
supposed to be terminated. I'm assuming that "maxlen" means "maximum number
of strings passed in array", not "maximum *length* of buffers supplied in
string array". The meaning of maxlen is crucial. Unfortunately it's
ambiguous.

That is, what you're passing is a pointer to a pointer list for both Text
arrays. There must be some way for the compiled function to determine when
it has reached the end of each list. Often the end marker is a NULL pointer,
and you'll have to use some spiffy spoofing to accomplish that.

If "maxlen" means "maximum length of buffers for strings", then this is a
retrieval call (not a "set" call) and you can use something like "Axes[i] =
"*" * maxlen;" to allocate a buffer for each Axis and name.

Take a look at ... oh. ****. I was going to point you to C Programming 101
but the article seems to have flown the coop. I'll see if I can dig up a
copy but I'm afraid I don't think I have a backup. Man that blows. Does
anybody by any chance have a copy of this in their browser cache?
-SHAWN-


-----Original Message-----
From: Graeme Hilton [mailto:GHilton@slb.com]
Sent: Thursday, August 19, 2004 10:23 AM
To: VRF
Subject: [vrf] Importing DLL's, passing by reference


Hi All,

A whileback I asked a few questions about rewriting function declarations
for
Vee compatibility.  Now I've finally got my hands on the hardware that the
functions are attempting to control and I can do some real testing.

My main issue at the moment is that I can't seem to get VEE to correctly
pass
parameters by reference.

For instance, a particular function has a declaration:
int __stdcall C843_qVST(int iId, char* *szAxes, char* *names, int maxlen);

The important part is char* *names which I have to pass in as a string of
NULLs
  of length maxlen.
1.  How do I create that in VEE?
2.  If I can't, how do I workaround?

Cheers,

--
Graeme Hilton
Product Engineer

Schlumberger Sensa

---
You are currently subscribed to vrf as: shawn@testech-ltd.com
To subscribe send a blank email to "join-vrf@it.lists.it.agilent.com".
To unsubscribe send a blank email to "leave-vrf@it.lists.it.agilent.com".
To send messages to this mailing list,  email "vrf@agilent.com".
If you need help with the mailing list send a message to
"owner-vrf@it.lists.it.agilent.com".


---
You are currently subscribed to vrf as: rsb@soco.agilent.com
To subscribe send a blank email to "join-vrf@it.lists.it.agilent.com".
To unsubscribe send a blank email to "leave-vrf@it.lists.it.agilent.com".
To send messages to this mailing list,  email "vrf@agilent.com". 
If you need help with the mailing list send a message to "owner-vrf@it.lists.it.agilent.com".

Outcomes