【发布时间】:2016-10-28 10:33:00
【问题描述】:
// Point.vala
namespace Test {
class Point {
public const int MY_CONST = 123;
public float x { get; set; }
public float y { get; set; }
}
}
有一个vala源文件,'Point.vala'
- --vapi
valac --vapi=Point.vapi --library=point -X -shared Point.vala:
// Point.vapi
namespace Test {
}
空...
- --internal-vapi
valac --internal-vapi=Point.vapi --header=Point.h --internal-header=Point_internal.h --library=point -X -shared Point.vala:
// Point.vapi
namespace Test {
[CCode (cheader_filename = "Point_internal.h")]
internal class Point {
public const int MY_CONST;
public Point ();
public float x { get; set; }
public float y { get; set; }
}
}
它看起来很完美,适合我
- --fast-vapi
valac --fast-vapi=Point.vapi --library=point -X -shared Point.vala:
// Point.vapi
using GLib;
namespace Test {
internal class Point {
public const int MY_CONST = 123; // error
public Point ();
public float x { get; set; }
public float y { get; set; }
}
}
这会在使用这个 vapi 时引发错误,error: External constants cannot use values
Q1:确切的区别是什么?以及为什么有这些选项。
Q2:为了创建共享库,我应该使用--internal-vapi吗?
【问题讨论】: