On Wednesday, 31 December 2014 at 10:26:18 UTC, OlaOst wrote:
Works fine for me on windows, after running 'dub upgrade'.

I tested the SharedLibVersion with a 2.0.1 and a 2.0.3 SDL dll.
With the 2.0.3 dll, I could call functions added in SDL 2.0.2 even when using SharedLibVersion(2, 0, 0) - is this intended behaviour?

Yes. I guess I wasn't clear about this in my blog post. This isn't telling Derelict to "only load 2.0.0 functions and ignore the rest." It's instead saying, "Don't throw any exceptions if functions from 2.0.1 and 2.0.2 are missing." If you give it a 2.0.1 DLL, it will load 2.0.1 functions. Give it a 2.0.2 DLL and it will load 2.0.2 functions, regardless of what you pass in SharedLibVersion. But now you can happily load 2.0.0 and not worry about SymbolLoadExceptions. See below for the big caveat.

With the 2.0.1 DLL I got the expected 'Failed to load symbol' error without using the SharedLibVersion, or using SharedLibVersion(2, 0, 2).

However, if I call one of the functions added in SDL 2.0.2 when loading the 2.0.1 context, I get an 'object.Error@(0): Access violation' error. Would it be possible to get a more informative error message in this case?

That's not a Derelict error message. That's coming from the system. Keep in mind that Derelict binds to shared libraries via function pointers, so if any functions aren't loaded, the corresponding function pointers will be null and you'll get an Access Violation as a result. You should *only* use the SharedLibVersion to specify your minimum required version, not as a "give me whatever you've got" kind of thing like OpenGL. If you need 2.0.1 functions, but not 2.0.2, then you should be passing SharedLibVersion( 2,0,1 ), not 2,0,0.

I also recommend that you get in the habit of always passing a SharedLibVersion to the load method so that you can future-proof your app. It will always load if you upgrade to take advantage of bug fixes, no matter which new API functions are added. If yo don't do this, then an update will cause it to stop loading older versions and only load the newest. In fact, I would love to remove the existing load methods completely, but I do need to maintain back compat.

Highly appreciate your work on Derelict, BTW.

Thanks! And thanks for trying out the new stuff.

Reply via email to