www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - I'm completely befuddled with compiling, linking, binding, etc.

reply WhatMeWorry <kheaser gmail.com> writes:
I'm using DUB's bindbc-sdl.  I'm dynamically loading sdl3.dll 
which I've renamed.

trying to load SDL3 dynamic link library: 
C:\Users\kheas\OneDrive\Documents\GitHub\Dfine\libraries\SDL3_3_4_2.dll
loadSDL returned: success
Searching for SDL on Windows
3004002
Your SDL version loaded was: 3.4.2
SDL_Init returned: true

So, I read that SDL_Surface* SDL_LoadPNG(const char *file); was 
introduced in SDL3 version 3.4.0.  So I think yippie! I've got 
this already, I've loaded 3.4.2. No more SDL_image.

So I add the function call:

SDL_Surface* sur = SDL_LoadPNG("test.png");

which returns:

libraries\load_sdl_libraries.d(117,24): Error: undefined 
identifier `SDL_LoadPNG`
     SDL_Surface* sur = SDL_LoadPNG("test.png");

So I then add:

import bindbc.sdl : SDL_Surface, SDL_LoadPNG;

which then returns,

libraries\load_sdl_libraries.d(14,8): Error: module `bindbc.sdl` 
import `SDL_LoadPNG` not found import bindbc.sdl : SDL_Surface, 
SDL_LoadPNG;

I have the dub.sdl with what the docs say are most current. 
Double checked, SDL_LoadPNG is the correct name of the function.

dependency "bindbc-sdl" version="~>2.3.4"    // latest in the 
bindbc-sdl documentation
dependency "bindbc-loader" version="~>1.1.5" // latest in the 
bindbc-loader documentation
versions "SDL_3_4_2",                        // latest in the 
bindbc-sdl documentation

I'm stuck as to what to do next. Thanks in advance.
Mar 17
parent reply "Richard (Rikki) Andrew Cattermole" <richard cattermole.co.nz> writes:
It looks to me like SDL_LoadPNG is missing.

File a bug report: https://github.com/BindBC/bindbc-sdl/issues
Mar 17
parent reply WhatMeWorry <kheaser gmail.com> writes:
On Wednesday, 18 March 2026 at 01:39:22 UTC, Richard (Rikki) 
Andrew Cattermole wrote:
 It looks to me like SDL_LoadPNG is missing.

 File a bug report: https://github.com/BindBC/bindbc-sdl/issues
I did find this in source/sdl/surface.d so something else is amiss with my environment. if(sdlVersion >= Version(3,4,0)) { FnBind[] add = [ {q{SDL_Surface*}, q{SDL_LoadPNG}, q{const(char)* file}}, {q{bool}, q{SDL_SavePNG}, q{SDL_Surface* surface, const(char)* file}}, ]; ret ~= add; }
Mar 18
parent Steven Schveighoffer <schveiguy gmail.com> writes:
On Wednesday, 18 March 2026 at 19:54:58 UTC, WhatMeWorry wrote:
 On Wednesday, 18 March 2026 at 01:39:22 UTC, Richard (Rikki) 
 Andrew Cattermole wrote:
 It looks to me like SDL_LoadPNG is missing.

 File a bug report: https://github.com/BindBC/bindbc-sdl/issues
I did find this in source/sdl/surface.d so something else is amiss with my environment. ```d if(sdlVersion >= Version(3,4,0)) { FnBind[] add = [ {q{SDL_Surface*}, q{SDL_LoadPNG}, q{const(char)* file}}, {q{bool}, q{SDL_SavePNG}, q{SDL_Surface* surface, const(char)* file}}, ]; ret ~= add; } ```
I'm not extremely familiar with bindbc-sdl, but I'm pretty sure you not only have to add the dependency, but you have to declare to bindbc-sdl the *minimum* version you want to support. Without any config, it specifies the oldest version available. You do this by adding a `version` directive in your dub recipe file. https://github.com/BindBC/bindbc-sdl?tab=readme-ov-file#sdl-versions -Steve
Mar 19