Re: [Vala] Generating vapi file for a simple struct

Matías De la Puente <mfpuente ar gmail com> wrote:

Hi, you should make unowned the array, like this:

[CCode (cheader_filename = "oslib/os.h")]
namespace OSLib
 [CCode (cname = "os_error", cprefix = "", clower_case_prefix = "")]
  public struct OSError {
   public int errnum;
   public unowned char[252] errmess;

If you put some memory managed objects in a struct (strings,
arrays, Objects, etc) they have to be destroyed, but i you don't
have that you should put unowned to that objects.

Thanks, that worked perfectly! :-)

Is there any need for the cprefix and clower_case_prefix in this
case? I get the impression that they are not used as long as I
specify the cname itself.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]