PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Static library that uses another static library (i.e. PHAL)

I'm building my gfx static library. Is it possible to build static library that uses another static library (for i.e. PHAL)? I need to have only one static library that contains my code and code of another static lubrary. After that I'm going to use only one static library I built.
You should be able to simply include the PHAL library in your own .lib project.
You should be able to simply include the PHAL library in your own .lib project.


I can't find such an option in the MSVC.

I must underline: I need to have one working static .lib (I don't want to link with both my.lib and phal.lib in my working program that uses my.lib).
It's not an option, you just add the .lib file to your project like you would for a .cpp file.
It's not an option, you just add the .lib file to your project like you would for a .cpp file.


I couldn't solve the problem going this way.

I've made the model of the problem with explanation. I've attached project files to this message.

testlib1 - static library that contains function: double sqrt2(int)
testlib2 - static library that contains function: double tripple(int); function tripple uses sqrt2; I've added testlib1.lib into this project as common .cpp file
testapp - application that uses testlib2 only; it realy can't find double sqrt2(int).
BurningSheep · 25 Feb 2004, 13:09 UTC
Sounds like you forgot to set your dependencies. Select your app, go to project->dependencies and check the libs it requires.
BurningSheep wrote:Sounds like you forgot to set your dependencies. Select your app, go to project->dependencies and check the libs it requires.


I setup my dependeces correctly. My problem is that I need to include one static lib to another, and use only the seconds without linking to first one.
May I ask why you want to do that in the first place? What is the problem you experience with linking to multiple librairies?
I want users of that library don't know its implementation. The implementation can be changed anytime. I want users only worked with API provided and one library.

Thierry could you please see in the files I've attached in the previous post.
You do realize that you aren't allowed to distribute your own library linked with PocketHAL? Right?
Maxim wrote:
testlib1 - static library that contains function: double sqrt2(int)
testlib2 - static library that contains function: double tripple(int); function tripple uses sqrt2; I've added testlib1.lib into this project as common .cpp file
testapp - application that uses testlib2 only; it realy can't find double sqrt2(int).


I don't think it works the way you think. You don't provide any exposure in testlib2 for the functions in testlib1. testlib2 should have a function in it that calls the sqrt2(int) function from testlib1. This hides the dependency on the implementation of testlib1, and since testlib2 is already compiled, you will only be linking to it.

Similarly, I can include stdio.h in a lib, but that doesn't mean my app has access to stdio unless I also include it there. I could, however, write wrapper functions in the lib that call stdio and expose the functionality via my own interface.

Pam
then distribute ur lib and ask user to download PHAL ? //an assumption
denthorq wrote:then distribute ur lib and ask user to download PHAL ? //an assumption


Yes that's fine. Or ask me permission to distribute PHAL with your lib, like Jacco did for his new lib.
Essentially, if the guy makes his own library and distributes it, and it includes PHAL's library, he's violated Thierry's copyright privileges for PHAL (unless he had Thierry's permission to do so).

Since PHAL is a replacement for GAPI, it's really no different a situation from if Johan replaced the GAPI component in GapiDraw with PHAL, but still distributed it as GapiDraw. Johan wouldn't do that, of course, but you get the idea.

I recommend we don't help him hide PHAL inside his own library unless Thierry says it's ok.

-John
Thierry wrote:You do realize that you aren't allowed to distribute your own library linked with PocketHAL? Right?


Of, course! It's for using in my own project only. I don't intend to distribute PHAL.
Thank you Presto, that's exactly what it is.
Pam wrote:

I don't think it works the way you think. You don't provide any exposure in testlib2 for the functions in testlib1. testlib2 should have a function in it that calls the sqrt2(int) function from testlib1. This hides the dependency on the implementation of testlib1, and since testlib2 is already compiled, you will only be linking to it.

Similarly, I can include stdio.h in a lib, but that doesn't mean my app has access to stdio unless I also include it there. I could, however, write wrapper functions in the lib that call stdio and expose the functionality via my own interface.

Pam


So, is there no way to _include_ implementation code of static_lib_1 into static_lib_2, and then link to static_lib_2 only? And I have to build static_lib_1,static_lib_2 and link to both?
Presto wrote:Essentially, if the guy makes his own library and distributes it, and it includes PHAL's library, he's violated Thierry's copyright privileges for PHAL (unless he had Thierry's permission to do so).

Since PHAL is a replacement for GAPI, it's really no different a situation from if Johan replaced the GAPI component in GapiDraw with PHAL, but still distributed it as GapiDraw. Johan wouldn't do that, of course, but you get the idea.

I recommend we don't help him hide PHAL inside his own library unless Thierry says it's ok.

-John


I'll repeat. I DONT need and I DONT intend to DISTRIBUTE Thierry's library. I use it as backend of my own that I'm using in my own project. I DONT make such a dirty thing. And I'm going to donate to Thierry when my lib is ready.
Maxim wrote:I'll repeat. I DONT need and I DONT intend to DISTRIBUTE Thierry's library. I use it as backend of my own that I'm using in my own project. I DONT make such a dirty thing. And I'm going to donate to Thierry when my lib is ready.


Please understand that this is exactly what I want to prevent. Someone making a small donation to get a banner-free version of PHAL and then embedding it in his own lib, claiming it as his own work.

If this question had come from a PocketMatrix regular or someone I know, I would have a differenct attitude toward this question. But for all I know, you come from nowhere and might be asking us to help you break PHAL.

I am in no way trying to offend or accuse you of anything. Please just understand my position.

I can't find any reason why you need to do this except to hide the fact that you use PHAL in your implementation (and you admitted this yourself). Which brings a question you haven't clearly answered: from who are you trying to hide this fact?

If you are really trying to distribute another lib that uses PHAL, we can take this off-forum and discuss terms that would be beneficial to both of us. If not, then please do explain yourself so that I can clearly understand what is going on. Just repeating the question with more and more capital letters won't help your cause.
I agree, why would you need to hide PHAL? I've written my own lib on top of PHAL and I have to link both into my main project, however it's handled automatically because I include autolink.h in my libs main header file, which is then included in my main project, so my main project has absolutely no idea that i'm using PHAL and I could replace it in the lib without making any changes to the main project.
Thierry wrote:Please understand that this is exactly what I want to prevent. Someone making a small donation to get a banner-free version of PHAL and then embedding it in his own lib, claiming it as his own work.


I understand you. But I'm not trying claiming it as my own work. I'm going to _use_ it in my project only. If I can't please just say it and I'll try to replace it with maybe my code or anithing else.

Thierry wrote:
If this question had come from a PocketMatrix regular or someone I know, I would have a differenct attitude toward this question. But for all I know, you come from nowhere and might be asking us to help you break PHAL.


I'm not breaking PHAL, I'm trying to use it.

Thierry wrote:I am in no way trying to offend or accuse you of anything. Please just understand my position.


I understand.

Thierry wrote:I can't find any reason why you need to do this except to hide the fact that you use PHAL in your implementation (and you admitted this yourself). Which brings a question you haven't clearly answered: from who are you trying to hide this fact?


I'm not trying to hide this fact. If I tried I didn't post my message here =(.
I even haven't asked you for banner-free version yet. But if I was need to hide your lib I've asked you banner-free version and then asked how to hide it in the another forum. =( Please don't offend me.

Thierry wrote:If you are really trying to distribute another lib that uses PHAL, we can take this off-forum and discuss terms that would be beneficial to both of us. If not, then please do explain yourself so that I can clearly understand what is going on.


The answer is: I'm realy not. I'm trying to make my gfx interface independant, so I can just recompile my app with another version of my gfx lib to make it working. If there is so much problem to do it, I will linking with both - my lib and pockethal.lib.

I don't have any intention to redistribute my lib or your PHAL. Do you agree that using PHAL in my lib is not redistibution?

Thierry wrote:Just repeating the question with more and more capital letters won't help your cause.


Sorry if I've offended you. I've tried to underline.
Maxim: ok.

Thing is, I already told you everything I though would work. If this doesn't do it, I am afraid I can't help you.

I am still wondering why it is an issue at all. Simply link to both libs and/or use autolink.h like it was suggested by Bagal.
Ok. Thanks.