[lazarus] passing of a struct in pascal

Baeseman, Cliff Cliff.Baeseman at greenheck.com
Wed Oct 20 16:51:08 EDT 1999


High all,

for the QT engine I have defined a variant struct that can hold any type of
data yet be easy to deal with on both sides. I call it 
a lvariant which is a defined C struct. I was just using a void pointer in
the QT engine to pass any data to the engine and back but I wish to define a
type of variant structure to pass back and forth to make stuff like rect
where I need four integers a little easier to deal with on both ends.

 if I where to want to pass a pointer to a c struct in pascal is this the
correct way to do it.? Do I need to pack the records for this call.

  pinteger = ^integer;  

  lVariant = ^TLVariant
  {$PACKRECORDS 4}
  TLVariant = record
                    datatype: pinteger;
                    lstring: pchar;
                    lbuffer: pointer;
                   end;

  struct lazvaraint{
                          int *datatype;
                          char *lstring;
                          void * lbuffer; 
                          }



-----------------now the call to the c function

   var
   pstruct : lVariant;


  mycstructrequiringfunction(pstruct);

Cliff






More information about the Lazarus mailing list