Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DllImport fails find raylib.dll on Windows #200

Closed
yanchith opened this issue Sep 16, 2023 · 7 comments
Closed

DllImport fails find raylib.dll on Windows #200

yanchith opened this issue Sep 16, 2023 · 7 comments
Labels
bug Something isn't working question Further information is requested

Comments

@yanchith
Copy link

yanchith commented Sep 16, 2023

Issue description

I followed the manual installation instructions https://github.com/ChrisDill/Raylib-cs#installation---manual

When trying to launch a hello world example from the readme, it couldn't find raylib.dll.

Raylib-cs's build script seems to have copied the runtimes directory (and all dlls within) to the project's build directory, but the exe itself then can't find the dll.

If I copy the dll manually next to the exe, the dll is found and all works.

Environment

OS: Windows 10
Raylib-cs version: tag v4.5.0.4
Raylib version: 4.5.0

Issue screenshot

Unhandled exception. System.DllNotFoundException: Unable to load DLL 'raylib' or one of its dependencies: The specified module could not be found. (0x8007007E)
   at Raylib_cs.Raylib.InitWindow(Int32 width, Int32 height, SByte* title)
   at Raylib_cs.Raylib.InitWindow(Int32 width, Int32 height, String title) in C:\Users\yanchith\workspace\coderdojo\Raylib-cs-gmae\Raylib-cs\Raylib-cs\types\Raylib.Utils.cs:line 13
   at HelloWorld.Program.Main() in C:\Users\yanchith\workspace\coderdojo\Raylib-cs-gmae\gmae\Program.cs:line 9

Code example

Reproduce on Windows 10 by following the manual installation instructions and copying the hello world program from the readme.

I actually have the repro here as well: https://github.com/yanchith/Raylib-cs-gmae (it is a template repository for the kids I teach)

@yanchith
Copy link
Author

I also have the same problem on macOS, but there even the workaround doesn't help. Should I open a separate issue for that?

@chrisdill
Copy link
Owner

chrisdill commented Sep 16, 2023

@yanchith Thanks for opening the issue. For now I would stick to copying it next to the exe instead when not using the nuget package. I will update the README to make this clearer. Been a known issue for a while in the dotnet sdk dotnet/sdk#19929.

@chrisdill
Copy link
Owner

No need for a separate issue. Issue can be tracked here for multiple platforms.

@chrisdill
Copy link
Owner

Also worth mentioning that you can try Raylib-cs.Native which aims to build raylib locally and copy next to the executable. Aim is to make manual installation easier however it is a work in progress. You can try it with the Examples project to compare.

@chrisdill chrisdill added the bug Something isn't working label Sep 16, 2023
@yanchith
Copy link
Author

Thanks! I'll try out the build-from-source version.

I have a hunch that macOS has some more issues, but'll post back here after I've tried

@chrisdill
Copy link
Owner

@yanchith Any update on this issue?

@chrisdill chrisdill added the question Further information is requested label Nov 15, 2023
@yanchith
Copy link
Author

Hi, unfortunately I don't have any updates. I got swamped by other stuff. Meanwhile the kids jumped engines 4 times, so I have no-one urging me to fix it.

Last I remember: the DLL issue on Windows was as we talked before - you had to copy the DLL next to the exe manually. On macOS, even the workaround didn't work. I don't know the library loading system on macOS very well, and gave up on figuring it out after some time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants