Bigloo community, 

I don't see a way to allocate an array of C structs.  If I have a C struct 
called "myStruct", I think I should be able to use (make-myStruct* 3) to 
return a pointer to a newly-allocated array of 3 myStructs.  However, it 
seems the only way to allocate a new C struct is to allocate them 1 at a 
time, using (myStruct* elt1 elt2 elt3).

http://www-sop.inria.fr/members/Manuel.Serrano/bigloo/doc/bigloo-28.html#The-C-interface
(see sections on Struct and Union types and section on C pointers)

This is what I have:

[aStruct.h:

typedef struct myStruct {
  int elt1;
  int elt2;
  int elt3;
} myStruct;

]//end of aStruct.h

(module aStruct
        (main testAStruct)
        (extern
         (include "aStruct.h")
         (type myStruct (struct
                         (elt1::int "elt1")
                         (elt2::int "elt2")
                         (elt3::int "elt3")
                         ) "myStruct")
         ;; automatically defined
         ;; (type myStruct* (pointer myStruct) "myStruct*")
         )
        )

(define (testAStruct argv)
   ; doesn't work                                                               
   ; (make-myStruct* 3)                                                         
   ; works                                                                      
   (myStruct* 1 2 3)

)

Thanks and regards,
Rory

Reply via email to