On Saturday, 23 May 2020 at 03:55:33 UTC, Mike Parker wrote:
On Saturday, 23 May 2020 at 03:25:12 UTC, Daniel C wrote:
This is what I'm getting:
Error 42: Symbol Undefined
__D6bindbc3sdl4bind9sdlevents9SDL_Event6__initZ
This isn't a symbol from the SDL library. It's a D symbol from
the binding.
I figured as much, that's why I tried to link against the
bindbc-sdl library at first (which then gave me the invalid
library file error). I removed it from the line I posted to get
that message to reappear.
You didn't link with the bindbc-sdl library. But a couple of
points about that -m32 option:
1. On Windows, DMD always builds with -m32 by default, so you
don't need to specify it.
2. It means you're using the default OPTLINK linker which
requires object files in the OMF format.
3. The COFF format is more common in the Windows ecosystem,
which the -m32mscoff and -m64 options will cause to be generated
4. Unlike DMD, dub will use the system architecture on Windows
for the default build, meaning on 64-bit Windows it will
automatically pass -m64 to DMD.
Ugh, I remember running into build issues when I gave D a shot a
few years ago. There's a lot of options and specifics that
aren't very well documented, or at the very least confusing. In
the case of Dub, it felt to me like some black box that wasn't
clear as to what it was doing (even having tried to read the
documentation a few times). I felt more in control and aware of
what was going on with dmd but lol, again I was missing something.
No. You can link to betterC libraries with a normal D app.
Oh, that's good news. I'll pass that option next time.. or
actually - I'm not sure what will change in the generated library?
Essentially, the bindbc-sdl library you built is invalid
because dub built it with -m64 (unless you explicitly passed
-ax86 on the dub command line) and you built your app with
-m32, giving you both an architecture mismatch and an object
file format mismatch.
Then your dmd command is missing the bindbc-sdl library, hence
the linker error.
Ah. Dub did do something mischievous after all ;-) And thanks,
yeah I'll add the bindbc-sdl library back in after I get my
command lines straight. More experimentation ahead.
Thanks so much for your help!