Results 1 to 2 of 2

Thread: Compiling clanlib dynamically

  1. #1

    Default Compiling clanlib dynamically

    Sorry if that's a dumb question but I couldn't find any settings with the configure app that come with clanlib source to compile clanlib dynamically (with .dll). Maybe there is one but I'm too dunb to find it. I'm using visual studio 2010 but I also have mingw.

    The reason why I would like to use .dll is to reduce the main .exe of my application made with clanlib, because right now most of it's size come from clanlib library but the thing is when I want to update my main .exe since the libs are included in it, I somehow resend them and that's a bit annoying in my opinion.

  2. #2
    Master Sorcerer
    Join Date
    Sep 2006


    There are currently no options in the setup wizard that will allow you to compile ClanLib as DLLs.

    The main issue with supporting such a thing would be that all public classes and functions in ClanLib needs to be correctly marked with a DLL export directive. We do have the defines CL_CORE_API and so on, but it was never done consistently so there will be classes where it is missing.

    A second issue is that might be a few private classes that also need to be exported. The quick solution would be to just add the CL_CORE_API to those too. Maybe the more clean solution would be to make proper public APIs for those cases. I can't remember the nature of these private exports, except it is things like CL_Win32Window that is defined in clanDisplay but then used by i.e. clanGL.

    If you want to experiment with it and fix these things:

    1) Open the configure program solution in Setup\configure-vc2010.sln. In the Resource View, open IDD_TARGET_PAGE and create a checkbox with the control name IDC_CHECK_INCLUDE_DLL. page_target.cpp should already have some code using this control. Compile configure. Place the new exe in the ClanLib folder and run it. This should give you the option of generating DLLs.

    2) Compile ClanLib. You will get some linker errors. Those all happen because some class is missing CL_API_CORE (or CL_API_DISPLAY, etc).

    3) Define CL_API_DLL in your project and compile. If you get some linker errors those happen because some class is missing CL_API_CORE. Add those to clanlib, compile again and continue until your program links.

    4) Post the patch here and we'll apply it.

    An alternative to all of the above might be to simply improve your patching strategy. I know there are tools out there that specialize in being good at patching exe files, although I do not know how well they work or if they are open source or not. Using DLLs for ClanLib will increase the size of the entire game since the linker is forced to include every feature in ClanLib in those DLLs, while with the static builds it can throw away those parts not in use.

Similar Threads

  1. Problems compiling ClanLib 2.0.3 on Ubuntu 9.04
    By gspawn in forum Official ClanLib SDK Forums
    Replies: 2
    Last Post: 08-18-2009, 12:34 AM
  2. Problem compiling ClanLib 0.8 in MAC OS X (10.3.9)
    By jplaza in forum Official ClanLib SDK Forums
    Replies: 2
    Last Post: 07-08-2008, 09:58 PM
  3. How to dynamically create sprites
    By rpwilson1 in forum Official ClanLib SDK Forums
    Replies: 2
    Last Post: 03-19-2008, 05:49 PM
  4. Help compiling ClanLib
    By Shauni in forum Official ClanLib SDK Forums
    Replies: 7
    Last Post: 06-28-2007, 12:53 AM
  5. Dynamically generate GUI buttons,labels and stuff
    By d_oilen in forum Official ClanLib SDK Forums
    Replies: 2
    Last Post: 11-22-2006, 09:21 AM



Posting Permissions

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