Go4Expert (http://www.go4expert.com/)
-   C++ (http://www.go4expert.com/forums/cpp/)
-   -   c++ libarys (http://www.go4expert.com/forums/cpp-libarys-t15413/)

TriG0rZ 5Dec2008 16:38

c++ libarys
does it matter how many libarys you include within a c++ program, so you can have like as many as you want and it wont mater OR does it, does having to many libars conflict with each other??

Thanks <3 TriG0rZ

shabbir 5Dec2008 17:11

Re: c++ libarys
As far as conflict goes no but if you include more your binary size increases

TriG0rZ 5Dec2008 17:24

Re: c++ libarys
oh right awesome thanks...another question what is binary size ^_^

xpi0t0s 5Dec2008 20:49

Re: c++ libarys
Size of your executable, i.e. number of bytes the file takes up on disk and in memory.
The executable size depends on how smart the linker is; ideally it shouldn't include any functions that aren't referenced, so you could have endless irrelevant libraries and it won't affect the resulting size, but if you have a dumb linker it will include everything anyway and every new library you add will increase the executable size.

shabbir 5Dec2008 21:06

Re: c++ libarys
In Visual Studio Linker can be manually set to Statically Link the MFC Dll or Dynamic Linking and if you choose Statically linked option you would see size of the exe grows to MB for hello world.

Now about the conflict its not that there cannot be a conflict but there is highly unlikely that multiple Libraries ( 3rd party ) have the same function defined with the same signature can lead to problems but then I haven't come across any such things but it could be that I am just lucky enough.

xpi0t0s 6Dec2008 03:53

Re: c++ libarys
It does happen from time to time, I had a customer at work only a few weeks ago with exactly this problem and he was insisting it was a bug in our software and demanding we changed it. He had also posted a similar message to the help forums on the other library. The forum was less polite than I was allowed to be and he got told where to go in very few words, but I was able to persuade him with the question "ok then, what name should we give the function that is guaranteed not to clash with any other software at any time past or future", or something like that.

Actually the problem isn't that difficult to solve, you just have two executables that run in parallel, one linking with one library and one linking with the other, and you define some kind of IPC between the two executables. One can be just a thin wrapper around one of the libraries; you don't necessarily have to split the application down the middle.

All times are GMT +5.5. The time now is 19:34.