Procedural Types

Mon, 07 Jul 1997 00:35:07 +0800


Somehow, procedural types are not transported through the GPIs correctly. I
am using gpc-970624 (BETA) for DJGPP 2.01. The following program
demonstrates this bug. In some (RANDOM!) cases, the program works, in others
it prints out only the first letter of the 'OK'. The bug does not only
affect functions returning CCtring (PChar) values, it affects all procedural
types (Procedures AND Functions).


BUG02_U.PAS:
------------

    Unit
        Bug02_U;

    {$X+}

    Interface

    Type
        TProcRec = Record
            Name1 : ^Function : CString;
            Name2 : ^Function : CString;
        End;
    
    
    Implementation

    End.


BUG02.PAS:
----------

    Program
        Bug02;
    Uses
        Bug02_U;
    
    {$X+}
    
    Var
        ProcRec : TProcRec;

    Function TheName : CString;
        Begin
            TheName := 'OK';
        End;

    Begin
        ProcRec.Name1 := @TheName;
        ProcRec.Name2 := @TheName;

        WriteLn(ProcRec.Name1^); { Prints out 'OK' }
        WriteLn(ProcRec.Name2^); { Prints out 'OK', or sometimes only 'O' }
    End.


Good Luck finding this bug

 ________________________
|  _)        | |             e-mail: bernie@icenet.com.au
|___)ernhard |_|schirren             ptschirrenb@cc.curtin.edu.au
                             www:    www.geocities.com/CollegePark/Quad/8070/


Bernhard Tschirren (bernie@icenet.com.au)

HTML conversion by Lluís de Yzaguirre i Maura
Institut de Lingüística Aplicada - Universitat "Pompeu Fabra"
e-mail: de_yza@upf.es