Page 1 of 1

C-Struct in Purebasic

Posted: Tue Apr 26, 2005 8:18 am
by Garfield9992003
Hi everyone.

How do i implement the following C-header struct in Purebasic?
I´ve tried with "structureunion" but this doesnt work.

Frank

Code: Select all

typedef   struct tagTest 
{ 
   struct 
   { 
      DWORD      T1 : 1; 
      DWORD      T2 : 1; 
      DWORD      T3 : 1; 
      DWORD      T4 : 2; 
      DWORD      T5 : 1; 
      DWORD      T6 : 1; 
      DWORD      T7 : 0; 
      DWORD      T8 : 1; 
      DWORD      T9 : 0; 
      DWORD      T10 : 1; 
      DWORD      T11 : 1; 
   } flag; 
   ENUM_1   Test1; 
   ENUM_2   Test2; 
} TEST, *PTEST;

Posted: Tue Apr 26, 2005 9:53 am
by GedB
Unfortunately, you cannot do nested structures in PB.

You have to define the inner structure separately, like so:

Code: Select all

Structure InsideTagTest
  T1
  T2
  T3
  T4
  T5
  T6
  T7
  T8
  T9
  T10
  T11
EndStructure

Structure TagTest
  flag.InsideTagTest
  test1
  test2
EndStructure