AnsweredAssumed Answered

user function output

Question asked by VRFuser on Mar 7, 2002
Just a note from a paranoid Support guy (we're all paranoid. In Support,
that's healthy!)

As George rightly notes, this is undocumented stuff. As such, it can cause
many bad things to happen that we can't help you with:

- it might stop working with particular parameters or ways of invoking it
(e.g. stick in a parameter with a value of -1 instead of +1, DLL calls,
remote function calls, etc)

- it might stop working in the next revision. In the worst case, it might
stop working in the next rev just after you've finished building a huge
program around it and discovered you MUST HAVE some enhancement or
compatibility or bugfix that's ONLY in that next rev.

One of the VEE R&D engineers who frequents the vrf (a guardian angel!)
mentioned that the source code that makes the ByRef magic work is very
complex, and that it wouldn't be at all surprising if things are working for
you by chance. That same complexity also implies:

- it is more likely to have a bug in it that we'll have to fix some day, and
the fix might just break the unsupported functionality you're depending on

- after we fix the bug and break the undocumented ByRef "feature", it's that
much harder to restore the functionality you want because the code is
complex. If it comes to an either/or decision, we will have to go with the
change that fixes the real bug and perhaps breaks the undocumented
"feature", and we'll be reluctant to spend lots of time fixing the
undocumented "feature" again



I can't and don't want to tell you how to write your programs. You're the
best judges of that. But I do feel an obligation to warn you of potential
dangers and what our position will have to be in such an eventuality.

Sincerely,


Scott Bayes
Software Technical Support

Agilent Technologies, Inc.
815 14th Street S.W.
Loveland, CO, U.S.A. 80537

> -----Original Message-----
> From: Georg Nied [mailto:g.nied@gn-software.de]
> Sent: Thursday, March 07, 2002 3:44 AM
> To: paul_chandler@Agilent.com; vrf@lvld.agilent.com
> Subject: vrf RE: user function output
>
>
> Paul,
>
> in general: it is not possible to select which output is used by the
> standard 'Result' output of a formula-called use function.
> But you can use a trick to use a similar functionality as you
> want: the
> (mostly unknown) parameter 'By Ref'.
> This works only if you call your function with all the wanted output
> parameters declared as input parameters as well.
>
> So your UserFunction should be declared as:
>
> ReadTemperature (address, SetPoint, PresentTemp, On, Alarm)
> that is: 5 input parameters and 5 output parameters.
>
> if you now call your function this way:
>
> SetPoint=0;
> PresentTemp=0;
> On=0;
> Alarm=0;
> Address=ReadTemperature (2, ByRef SetPoint, ByRef
> PresentTemp, ByRef On,
> ByRef Alarm)
>
> the values are returned by the parameters and you can
> continue to use them.
>
> But beware: this seems to be an undocumented feature and you
> must follow the
> following rules:
>
> 1) do not use the 'ByRef' parameter for the first output variable.
>    (It is already read from the stack for the 'Return' pin!)
> 2) if you need to use any of the parameters you must declare all
>    the parameters before as 'ByRef' too, except the first one (see 1)!
>        eg: Address=ReadTemperature(2, SetPoint, ByRef
> PresentTemp, ByRef On,
> ByRef Alarm)
>    would mix up the results!
> 3) parameters not needed as result should be placed at the end of
>    the list an can be left out or passed as value:
>        eg:  Address=ReadTemperature(2, ByRef SetPoint, ByRef
> PresentTemp,
> On, 1)
>
> See the example !
>
> Was an interesting thing, ask if you have questions
>
> Georg
>
>      Georg Nied
>  Software-Development
>  Test and Measurement
> 51149 Cologne  Germany
g.nied@gn-software.de
>
>
>
>
> -----Original Message-----
> From: owner-vrf@lvld.agilent.com [mailto:owner-vrf@lvld.agilent.com]On
> Behalf Of paul_chandler@Agilent.com
> Sent: Thursday, March 07, 2002 1:16 AM
> To: vrf@lvld.agilent.com
> Subject: vrf Date: Wed, 6 Mar 2002 17:15:33 -0700
>
>
> Hi,
>  I have a UserFunction called Read Temperature with a single
> input (address)
> and multiple outputs(SetPoint, PresentTemperature, %On,
> Alarm). I would like
> to use it in a formula object:
>
>        ReadTemperature(address)
>
>   The default output is SetPoint, how do I select a different output?
>
>   Thanks,
>    Paul Chandler
>
>
> ---------------------------------------------------------------------
> This is the "vrf" maillist, managed by Majordomo.  To send messages to
> this maillist, just email to "vrf@lvld.agilent.com". 
> Subscriptions and
> unsubscriptions are done through the address
> "vrf-request@lvld.agilent.com".
> If you need details, just send a message containing the text "help"
> to "vrf-request@lvld.agilent.com".
> ---------------------------------------------------------------------
>
>
---------------------------------------------------------------------
This is the "vrf" maillist, managed by Majordomo.  To send messages to
this maillist, just email to "vrf@lvld.agilent.com".  Subscriptions and
unsubscriptions are done through the address "vrf-request@lvld.agilent.com".
If you need details, just send a message containing the text "help"
to "vrf-request@lvld.agilent.com".
---------------------------------------------------------------------

Outcomes