Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 1999-10

passing of a struct in pascal

3 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Baeseman, Cliff

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

Reply by email

Baeseman, Cliff

yep thanx Florian I already got it.

Cliff

Earlier message 23 lines
-----Original Message----- From: Florian Klaempfl Sent: Thursday, October 21, 1999 3:48 AM To: Subject: Re: [lazarus] passing of a struct in pascal "Baeseman, Cliff" schrieb: > 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} I think you should use {$PACKRECORDS C} _________________________________________________________________ To unsubscribe: mail with "unsubscribe" as the Subject archives at http://www.miraclec.com/list_archives/lazarus

Reply by email