Microsoft KB Archive/122591

= PRB: How to Change Variable Value Passed by Reference in LCK =

Q122591

-

The information in this article applies to:


 * Microsoft Visual FoxPro for Windows, versions 3.0, 3.0b
 * Microsoft FoxPro Library Construction Kit included with the Professional Edition of:
 * Microsoft FoxPro for Windows, versions 2.5, 2.5a, 2.5b, 2.6, 2.6a
 * Microsoft FoxPro for MS-DOS, versions 2.5, 2.5a, 2.5b, 2.6, 2.6a
 * Microsoft FoxPro for Macintosh, versions 2.5b, 2.5c, 2.6a

-

SYMPTOMS
When passing a variable by reference to a Library Construction Kit (LCK) library and changing the value of that variable in the library routine, sometimes the variable in FoxPro in not changed correctly. This behavior occurs usually with a numeric variable.

RESOLUTION
Usually VAL.EV_LONG is used when working with numbers that are passed from FoxPro. If the numeric variable is passed by reference and the user wants to change the variable so that FoxPro sees the change, then EV.TYPE should be used. The following sample code is an example.

Sample Code
            **** CODE USED IN FOXPRO **** CLEAR SET LIBRARY TO Double.fll x = 1.1 ?"Before" ?x =DOUBLE(@x) ?"After" ?x SET LIBRARY TO

*** CODE USED IN C TO MAKE FLL **** // Double.C   Doubles the value of a variable

#include 

void FAR Double(ParamBlk FAR *parm) {  Value val;

_Load(&parm->p[0].loc,&val);

if (val.ev_type == 'N') val.ev_real = 2.0 * val.ev_real; else if (val.ev_type == 'I') val.ev_long = 2 * val.ev_long; else _Error(9); // "Data type mismatch"

_Store(&parm->p[0].loc,&val); }

FoxInfo myFoxInfo[] = { {"DOUBLE", (FPFI) Double, 1, "R"}, };

FoxTable _FoxTable = { (FoxTable FAR *)0, sizeof(myFoxInfo)/sizeof(FoxInfo),myFoxInfo };

STATUS
This behavior is by design.

Additional query words: FoxWin FoxDos FoxMac LCK

Keywords : kbcode

Issue type :

Technology : kbHWMAC kbOSMAC kbVFPsearch kbAudDeveloper kbFoxproSearch kbZNotKeyword3 kbFoxPro250bMac kbFoxPro260aMac kbFoxPro250cMac kbFoxPro250DOS kbFoxPro250aDOS kbFoxPro250bDOS kbFoxPro260DOS kbFoxPro260aDOS kbFoxPro260 kbFoxPro250 kbFoxPro250a kbFoxPro250b kbFoxPro260a kbVFP300 kbVFP300b

Last Reviewed: February 11, 2000

-

[mailto:MSDN@MICROSOFT.COM Send feedback to Microsoft]

© 2002 Microsoft Corporation. All rights reserved.