BindBC Updates: new loader function, SDL_net, streamlined SDL_* version indentifiers

Mike Parker aldacron at gmail.com
Sat May 23 03:55:33 UTC 2020


On Saturday, 23 May 2020 at 03:25:12 UTC, Daniel C wrote:
> On Saturday, 23 May 2020 at 01:23:38 UTC, Mike Parker wrote:
>> What download are you referring to? I don't have any library 
>> files in the git repository, and I don't know of any downloads 
>> from the duo repository.
>
> Huh.. I'm not sure, it must have gotten there when I dub'd 
> something lol.  Sorry

It gets there when you build it :-)

>
>>> Also, when setting it to static compile, it complains during 
>>> linking there are missing functions, even though I've already 
>>> added the appropriate SDL library files.
>>
>> What are the missing symbols?
>
> 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.

>
>> Are you building it separately from your app? Or is it a 
>> dependency in your app's dub configuration?
>
> I did build it using dub from the downloaded folder, but I 
> suppose that was pointless as the .lib file that's generated 
> isn't even recognized.
>
> I'm building my app without dub.  I've now put all the source 
> files into the same folder as my project and I'm still seeing 
> the same undefined symbol issue.
>
>>
>> Please provide the commands you are using and the errors you 
>> are seeing. Then I can have an idea of what's going on.
>
> dmd.exe sdl_bindbc_test.d -g -m32 -w -debug 
> -version=BindSDL_Static -version=SDL_2012 
> -version=SDL_Image_205 SDL2.lib SDL2_image.lib

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.

>
> Honestly it could be something I'm missing.  I saw the 
> "-betterC" option in the documentation, but I assumed that my 
> entire app would need to use -betterC so I avoided it.

No. You can link to betterC libraries with a normal D app.

>
> Apologies if it's something dumb I'm overlooking.

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.



More information about the Digitalmars-d-announce mailing list