#importing raylib dll into a new project

1 messages · Page 1 of 1 (latest)

signal nest
#

Hi

I am trying to import the raylib library as a dll into my new zig project, but struggling a bit with the build steps for this.
I have created a new ini-exe project and added the raylib dlls and header files into a libs folder.
In my build.zig, I have tried to link to the dll and header includes as

    exe.linkSystemLibrary("libs/dyn/raylib.dll");
    exe.addIncludePath(.{ .path = "libs/includes" });
    b.installArtifact(exe);

My main.zig file is

const std = @import("std");
const ray = @cImport({
    @cInclude("raylib.h");
    @cInclude("rlgl.h");
    @cInclude("raygui.h");
});

pub fn main() !void {
    ray.InitWindow(800, 600, "raylib [core] example - test basic window");
    defer ray.CloseWindow();

    while (!ray.WindowShouldClose()) {
        ray.BeginDrawing();
        defer ray.EndDrawing();
        ray.ClearBackground(ray.RAYWHITE);
        ray.DrawText("Congrats! You created your first window!", 190, 200, 20, ray.LIGHTGRAY);
    }
}

I am not able to give the proper path to the dll it seems. I have tried a lot of approaches, including copying the dll to my zig-out folder and the project root but I am able to link them successfully. Any ideas what I am doing wrong?

zig build-exe raydil Debug native: error: error: unable to find Dynamic system library 'raylib.dll' using strategy 'paths_first'. searched paths: none
delicate hill
#

I have a similar issue on macOS.

signal nest
#

Any help please?

hoary valley
#

I think you'd need to have a step in your build.zig to copy the dll into the output folder

signal nest
#

i did manually copy the dll to my output folder. but i am still not able to link it

hoary valley
#

Oh I didn't see that sorry

autumn pivot
#

Hi do you really need to use the DLL or are you fine with including the source of raylib in your project?