-
Notifications
You must be signed in to change notification settings - Fork 91
Question - Shared libraries #31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The
There is no real limit on the project size. The limit is rather on the thread quantity (254 max) and how heavily you instrument your code with active logging (disabled logging at compile time do not count).
As mention in the first paragraph, I guess that it is due to either:
And as you mention, |
You also have an example program, just see the beginning of the file |
You don't understand, but I mean you have one library and want to share that library with other libraries. So you want to have one instance of your profiler and you want to collect all data from different libraries that are linked to one executable. Like your exe consists of:
Because I just can't compile your solution with that implementation or if you use it in header file as the result you will get many redefinitions and still get linking problems. The question is can you use it with that type of solution where you split libraries into components? For the first time as I understand your implementation, you use #define USE_PL 1 in order to define your functions after in cpp file you declare those functions (#define PL_IMPLEMENTATION 1) and the problem is I get linking problems like implementations of those functions don't exist at all and that's why I asked you about this. Because the library where the profiler is located just compiles successfully, but when I want to link it to executable I got that link error. |
You can try to create a real simple project with two static libraries and one executable. Where one static library contains the definitions and the declarations of your functions like plStart and plSetFilename and the second static library collects all function calls by plScope only. And you want to link those libraries to your executable. |
The title of the issue mentions "shared libraries" but your initial description mentions several times "static library", that confused me. So you are describing an executable with several dynamic/shared libraries that are also instrumented. Your library structure described above seems to be ok, it is however not clear where your "main" is...
That is the theory, at least. I will try it on my side indeed to ensure that there are no "surprise".
The |
@dfeneyrou I will appreciate it if you can implement the type of solution that I have described before. One library just uses plScope only and the second library contains an implementation of palanteer (PL_IMPLEMENTATION 1 in .cpp once respectively) and the executable just calls some functions from them in order to test it. |
I don't think it was my problem with integrating your library... Because I wasted a lot of time and thought I did all things right according to your documentation and examples. |
Anyway, I don't think there's something wrong if you create another example with a "different architecture type" as the more advanced example of your integration. |
I confirm that my above proposal of dynamic library structure works straight under Linux. Indeed, Windows requires explicit marking of shared APIs with |
@dfeneyrou how is it going? |
Sorry for late answer. I had very few time recently to continue the work (I used to live in Kyiv...), I am now in better conditions to resume it. |
Has the library a design for working in separated projects but they can be connected with one static library? I mean is it possible to create one class with implementation where it is a wrapper for palanteer. Otherwise, I can't understand why the header file doesn't include code even if I declare preprocessor PL_IMPLEMENTATION clearly in .cpp file.
Or the purpose of this library is to test small codebases because I can't imagine how to use it if you have many separated projects that are connected with one main static library.
As the result, I have the error LNK2019: unresolved external symbol. Describe the correct usage of your header in the case when I want to use the implementation in .cpp file, but have declarations of functions (USE_PL) in a header file and share it between all projects. It's really sad if I can't do that at all.
The text was updated successfully, but these errors were encountered: