Proper C Pointer Binding
"Róbert László Páli"
robertlaszlopali at gmail.com
Sat Apr 5 06:55:26 PDT 2014
Thanks for the suggestions! I think then I will stay with
a wrapping struct. How would I make the extern C functions
invisible for other sources?
extern (C) c_ulong loadFont(char * path);
extern (C) void render(c_ulong font, char * text);
extern (C) void destroyFont(c_ulong font);
struct Font {
private:
c_ulong ptr;
public:
this(string path) {
ptr = loadFont(path.toStringz());
}
void render(string text) {
render(ptr, text.toStringz());
}
~this() {
destroyFont(ptr);
}
}
When released as a library I would simply not put them
in the di Files, but I do not really want to use di-s for
developing the lib, but generate them for release.
Can I declare these extern C functions inline the
methods using it?
More information about the Digitalmars-d
mailing list