HaxeFoundation/hxcpp

Question about native structs

Closed this issue · 1 comments

How can I extern a native struct like below with hxcpp?

struct notify_request {
  char title[45];
  char message[3075];
};
@:keep
@:native('notify_request')
@:structAccess
@:unreflective
extern class NotifyRequestStruct {
    public static inline function create(): NotifyRequestStruct {
        return untyped __cpp__('{}');
    }

    public static inline function size():SizeT {
        return cpp.Native.sizeof(NotifyRequestStruct);
    }

    public var title:CastCharStar;
    public var message:CastCharStar;
}

Using it as above solved my problem.