CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2009
    Posts
    12

    Understanding Redistribution + XML

    Okay I have 2 questions and again, firstly about distribution.

    Okay I come from a java background so c++ is a big change in terms of how it works, I have mainly been using libraries from STL but have now found myself needing external libraries like boost, wxwidgets and a few other less known ones and etc.

    My question is that many of them come as shared libraries which means if I compile and give it to someone, they will need to download and install those libraries right?

    Could I instead get the source of each of those libraries and instead building those source code into static or shared library just include them in my program and let the compilation of my program build all the necessary files that I include and this should include all the .obj files and necessary code into my final executable right? Like compiling with a static library.

    I know ideally I should use shared libraries to minimize my executable size but maybe i'm not understanding how to distribute my program when I use shared libraries. (This is the side effect of coming from a Java background where these are simplified and mostly transparent)

    Or do these libraries work differently and I have to build them before I use them? I'm just wondering how can I make my final app portable without needing anyone to install anything? Or do i have to create a installer package with all the libraries I use and i'm responsible for automating the build and etc??? I hope not.

    Lastly a very quick question, I don't think STL has any support for parsing, reading/writing xml files right? Anyone know a good library for XML in c++ ? I haven't see any in Boost either (i think)

    Thanks for any help,
    please help with my silly confusion.

  2. #2
    Join Date
    Jan 2004
    Location
    Düsseldorf, Germany
    Posts
    2,401

    Re: Understanding Redistribution + XML

    Quote Originally Posted by iQoder View Post
    Okay I come from a java background so c++ is a big change in terms of how it works, I have mainly been using libraries from STL but have now found myself needing external libraries like boost, wxwidgets and a few other less known ones and etc.

    My question is that many of them come as shared libraries which means if I compile and give it to someone, they will need to download and install those libraries right?

    Could I instead get the source of each of those libraries and instead building those source code into static or shared library just include them in my program and let the compilation of my program build all the necessary files that I include and this should include all the .obj files and necessary code into my final executable right? Like compiling with a static library.
    Most libraries are distributed as shared and static libraries. If you don't want your installation to depend on libraries, you will just have to link against the static libraries.
    Quote Originally Posted by iQoder View Post
    Or do i have to create a installer package with all the libraries I use and i'm responsible for automating the build and etc??? I hope not.
    I'm not sure what systems you want to distribute to. All sophisticated Operating Systems (Solaris, HP-UX, all Linux distributions) have a packaging system, so you should create a platform dependent package. The package description then holds information, what other packages are required to run your package, i.e. something like libwxwidget would be a requirement for your package. The installer on the platform would then check this requirement and inform the user what other packages are missing.

    I believe Microsoft still thinks that such a packaging system is notorious nonsense and the common practice for windows is to dump all required libraries into the same package, so that the user ends up with multiple copies of each library in different directories.

    Quote Originally Posted by iQoder View Post
    Lastly a very quick question, I don't think STL has any support for parsing, reading/writing xml files right? Anyone know a good library for XML in c++ ? I haven't see any in Boost either (i think)
    Google XML Parser C++.

    It should lead you at least to xerces-c++, libxml2 and expat.
    More computing sins are committed in the name of efficiency (without necessarily achieving it) than for any other single reason - including blind stupidity. --W.A.Wulf

    Premature optimization is the root of all evil --Donald E. Knuth


    Please read Information on posting before posting, especially the info on using [code] tags.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured