August 27, 2021

On 8/27/21 10:35 AM, Ki Rill wrote:

>

On Friday, 27 August 2021 at 13:54:18 UTC, Steven Schveighoffer wrote:

>

In the end, I got it to build and run, but I'd highly recommend just linking against the raylibdll.lib and using the dll.

Steve, thank you! I got it working with raylibdll.lib!

Yes, either 3.5.0 or 3.7.0, they now build with 2 types of libs, static and dynamic. The raylib.lib file is for static linking, the raylibdll.lib file is for DLL.

Glad you got it working!

>
  1. put raylib.dll and raylibdll.lib into your project's folder (into the same directory, where you have dub.json)

You know, I taught a class using raylib and D (I learned a lot from your video series, thanks!), and I didn't even think about just copy the libraries to your project directory as a "step". Instead I had them put in the /LIBDIR flags to wherever they installed it.

This way is MUCH easier, I think I'll switch to that.

dub in general has some rough edges when linking against libraries that aren't in default locations. Having to edit the dub.json file is sub-par.

-Steve

August 27, 2021

On 8/27/21 11:19 AM, Ki Rill wrote:

>

On Friday, 27 August 2021 at 14:52:15 UTC, Mike Parker wrote:

>

On Friday, 27 August 2021 at 14:46:56 UTC, Ki Rill wrote:

>

On Friday, 27 August 2021 at 13:54:18 UTC, Steven Schveighoffer wrote:

>

[...]

How do I tell DUB where to look for raylibdll.lib and raylib.dll? Via lflags section? What if I put them in a different folder instead of the project's directory?

Yes. The path goes in the lflags directive using whatever the linker-specific flag is. I assume for lld it's -Lpath. For MS link it's /LIBPATH:path.

To clarify, the .dll file's path is not embedded into the binary. You have to add it's path to your "Path" environment variable in order for your game to load it.

But you do need the /LIBPATH option to tell it where to find the .lib file.

>

I've added lfags:

"lflags": ["/LIBPATH:C:\\Users\\Username\\Desktop\\test\\source\\"]

But now it cannot find the following:

msvcrt120.lib
OLDNAMES.lib
shell32.lib

I think lfags overrides the default search path and I need to add it manually as well. But what is that path on Windows?

That shouldn't happen. I've never had to tell it where the default libraries are. For sure the lflags does NOT override the default library search paths.

I suspect your MSVC installation is bad, or there are some other switches causing problems.

-Steve

August 27, 2021

On Friday, 27 August 2021 at 15:24:14 UTC, Steven Schveighoffer wrote:

>

I suspect your MSVC installation is bad, or there are some other switches causing problems.

-Steve

Hmm... well, I will use the default setup and think about it later.

I mostly use Linux, Windows realm is an uncharted territory for me.

August 27, 2021

On 8/27/21 11:43 AM, Ki Rill wrote:

>

On Friday, 27 August 2021 at 15:24:14 UTC, Steven Schveighoffer wrote:

>

I suspect your MSVC installation is bad, or there are some other switches causing problems.

Hmm... well, I will use the default setup and think about it later.

I mostly use Linux, Windows realm is an uncharted territory for me.

Take my diagnoses with a grain of salt -- I mostly use MacOS and Linux, and I'm mostly lost on Windows. I was proficient with Visual C++ 5 or so a long time ago ;)

-Steve

1 2
Next ›   Last »