oBFusCATed,
I've ditched the example I started out with. I probably erected the testConsole project in the same folder as the library I wanted to test - or changed target between shared/dynamic, and it does work.
But, I've started from scratch testing the static, shared and dynamic-dll example library-projects in associated console-test-projects. Only the shared library project will not work. The functions of the static library becomes available in the console if I
#include <main.c> // which would be the source-file name of the static library
All the console test projects (that I've made) has one source-file, "main.cpp". The shared library has one source-file of the same name, and when I set the test-console up and include "main.cpp", the compilation goes into an infinit loop. That may not be odd, but how would I set your example projects up to work without this error?
I would like to be sure that I do it right because I have more ambitious projects in mind. I have opengl code working with all my hearts desire of functionallity .. in the context of a console project. I would like to make a dynamic or shared library of that functionallity. So far I've managed to put the vital initiations in one separate class (class.h & class.cpp in the console project), and the console can instantiate an object and run it. Compiling has not succeeded in one go, I've had to add functions to the class one by one to finally end up with all contained - so I'm not very confident that I can just move the class.h & class.cpp to some library and expect it to work. Best to have it in a shared library, so I tried the above.
I've read part of Peter Scmidt's book "Software build systems", but he speaks almost solely of dll's, not shared libraries. I'm not sure of the differences. Both code::blocks's examples produces .a and .dll output, but the contents of the examples are very different. I take that the dynDell looks odd because of the use of windows.h and all what follows.
Can I make you test the shared library project with a console-project to see if you get the same infinite loop, or suggest what I could be doing wrong?
I link to libSomeName, and let linker search in the library where it is
The only sourcefiles is in the same folder as the project, so I let the compiler search there. It could make sense that any of them might need the object-files, but I think that I've added search to those libs as well. We are talking about console execution from within code::blocks. I've made sure that execution outside needs the library in the same folder as the .exe.
I'll go home and try something more .. it usually works at the end (though I don't always knows why)
CarstenT