Monday, 19 June 2023

Class library

I've had this idea about creating a shared class library for my main projects. Today I just did it, but it was not what I expected... I started with Brick Atelier, because it's an "easy" project to fix if something goes wrong. The way you create a library and add it to the existing project (or solution) in Visual Studio is quite easy, but I already have something to think about.

Some classes in the planned library are using SDL2 which I guess is easy enough to add in the library, too. I'm just wondering is there any complications in the way sdl's .dll is used. Because if you create a static library, does it require SDL also to be statically linked? One way to find out that would be trying it, but I'm in the process of crunching Brick's next release version. Then again, I think SDL2 can be statically linked, it no longer has that restrictive open source license, I think.

It is possible to keep the class library free from SDL2, but it does require some changes and also there are lots of SDL2-using classes that could be included in a library. It was a bit of a surprise that I was only able to move two files (with couple of classes) in the class library... but if you just plan it more like a library it could be possible to externalize quite some lines of code.

No comments: