Cross platform DLL's/Libaries

Started by
4 comments, last by jollyjeffers 20 years ago
Hello! I''m getting to the point where my project is a little bit big i.e. 99 source files and 21,000 lines of code in one C++ project. Also starting to take a while to compile (3.06ghz machine takes 45secs for a full compile! ) So, I want to look into splitting the project up - more specifically, moving as much of the engine code (Graphics, Maths, Input, Sound, Utils...) into seperate projects/libraries. I''ve found a couple of odd ways of doing this with VC++/Windows (using .dll''s with __declspec() things..) but I really need to find a way that is more cross-platform. As in, most of the development is done under WinXP/PC, but I need the option to make a reasonably trouble free switch over to linux/xbox/ps2 etc... etc... Is there any general solution to this? I don''t necessarily need it to be as robust as DLL''s - some sort of file-division that can be pulled together at compile-time is acceptable (.obj files??) Cheers, Jack

<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ]</small>

Advertisement
Try looking up "static libraries."
COM....

In a word COM...

COM basically addresses distributed programming... Whereby,
COM objects, which may be wrapped up in dlls and implemented
in C++, can be accessed by other C/C++ clients... as well as
VB clients and Java clients etc etc.

COM is a complex subject... Hell, DirectX API and OpenGL are
COM based... But well worth the effort if you''re really into
writing upgradeable modules that can be ''bolted'' into other
programs.

I''m not sure if you''d want to go down this root... But let me
know if you''re interested... I''ll send you some of my source
code... as well as advice on books and other info.

Peace!
COM is anything but cross-platform.

You''ll want to build up your own component technology that is similar to COM. Be sure to study some of the the reasons that COM made the choices that it did. You can cut out parts of COM that you don''t need -- for example, I don''t have any notion of reference counting in my project, the assumption is that any reference to components are weak. However, I am not going to support runtime unloading of components so thats why I can do make that change.

As for the physical layout of code it is going to be platform specific. You''ll have separate source files for Win32 and Linux libraries to say the least -- the macro hackery needed to use one file will drive you mad.

Good luck.
--God has paid us the intolerable compliment of loving us, in the deepest, most tragic, most inexorable sense.- C.S. Lewis
Static libraries are useful for this kind of purpose so long as the code in them isn''t going to change very often, DLLs exist in some form under Linux in the form of "shared libraries" and have the advantage where you don''t have to rebuild your project if you dynamically link to them.

Personally I''d go with static libs, never had a problem using them so far when writing code to work under Linux/Windows with out having to resort to any #ifdef magic.
cheers for the replies everyone! Seems like these ''static libraries'' are the thing I need I''ll go do my research now..

Jack

<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ]</small>

This topic is closed to new replies.

Advertisement