wip: working on dynamic linking

- Feat: add example for wrapping dynamically linked library
- Feat: add new tokens (import, extern, type, handle, struct, ref, out)
This commit is contained in:
samsonium
2026-10-28 21:43:56 +03:00
parent d93c315359
commit 567bf49d27
2 changed files with 79 additions and 33 deletions
+38
View File
@@ -0,0 +1,38 @@
extern "libglfw" {
type GLFWwindow = handle;
type GLFWmonitor = handle;
struct GLFWvidmode {
int width;
int height;
int redBits;
int greenBits;
int blueBits;
int refreshRate;
}
/// GLFWvidmode*
type GLFWvidmodeRef = ref GLFWvidmode;
/// Create window with specified [width], [height] and [title]
fn glfw_mkWindow(
int width,
int height,
str title,
GLFWmonitor mon,
GLFWwindow shr
) GLFWwindow = "glfwCreateWindow";
/// Get videomode from monitor [mon]
fn glfw_getVideoMode(
GLFWmonitor mon
) GLFWvidmodeRef = "glfwGetVideoMode";
/// Get framebuffer [width] and [height]
fn glfw_getFrameBufferSize(
GLFWwindow win,
out int width,
out int height
) = "glfwGetFramebufferSize";
}