%-----------------------------------------------------------------------------% :- module bb. :- interface. :- type bb_type. :- func init_bb_type = (bb_type::uo) is det. %-----------------------------------------------------------------------------% %-----------------------------------------------------------------------------% :- implementation. :- pragma foreign_decl("C", " typedef struct BBType BBType; struct BBType { int bb1; int bb2; }; "). :- pragma foreign_type("C", bb_type, "BBType *"). :- pragma foreign_proc("C", init_bb_type = (BB::uo), [will_not_call_mercury, promise_pure, thread_safe], " BB = MR_GC_NEW(BBType); BB->bb1 = 1; BB->bb1 = 2; "). %-----------------------------------------------------------------------------% % vim: ft=mercury ts=8 sw=4 et wm=0 tw=0