Horde3D

Next-Generation Graphics Engine
It is currently 21.11.2024, 19:53

All times are UTC + 1 hour




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: 30.07.2010, 16:27 
Offline

Joined: 15.02.2009, 02:13
Posts: 161
Location: Sydney Australia
Hi all, I guess this is more or less a question to Volker,

The GameEngine or "GaBaCo", looks very decent at first glance, something I'd like to test out on mobiles. The ability to dynamically load in libraries is pretty cool, but I was wondering if this could be pulled out in an easy way. I've only glanced over the code and saw that there's some kind of DynLib loading code from ogre which does this.

Ideally I'd like to just compile the core, and some components (animation, scenegraph, bullet physics, IK, sound) into one single static lib which can by linked into my app. Could I just remove all of the plugin loading or what would be the cleanest way to just emulate this behavior? I've never made code which dynamically loads libraries so I'm not sure how to remove the feature exactly... :)

Thanks!

_________________
-Alex
Website


Top
 Profile  
Reply with quote  
PostPosted: 30.07.2010, 20:04 
Offline
Tool Developer

Joined: 13.11.2007, 11:07
Posts: 1150
Location: Germany
It should be possible to remove the dynamic loading and replace it with some static function that call all the module registrations in a static lib. The only reason using dynamic libraries was the ability to publish only parts of the gameengine without dependency problems.


Top
 Profile  
Reply with quote  
PostPosted: 03.08.2010, 07:15 
Offline

Joined: 15.02.2009, 02:13
Posts: 161
Location: Sydney Australia
Ok I'm giving it a stab by just having a bunch of #ifdefs... :)

So far for load/unload in DynLib.cpp I've just got dummy "return true" "return false" but to grab the right symbol from the static compiled lib, I have no idea in DynLib.cpp:

void* DynLib::getSymbol( const std::string& strName ) const
{
return (void*)DYNLIB_GETSYM( m_hInst, strName.c_str() );
}

DYNLIB_GETSYM being the OS-specific function calls to grab symbols from a dynamic library handle.

What would I replace this with for static libs already inside the lib/exe?

Thanks!

_________________
-Alex
Website


Top
 Profile  
Reply with quote  
PostPosted: 03.08.2010, 09:13 
Offline

Joined: 24.03.2010, 10:17
Posts: 55
The process for dynamic loading is:

- Open the DLL/SharedObject (on Linux: dlopen)
- Get the pointer to a well-known function name (e.g. "dllLoadGamePlugin") (on Linux: dlsym)
- Call the function through the function pointer - this registers the plugin
(same is true for unloading - uses dllUnLoadGamePlugin function name)

Now the question is: how did you compile several modules into one static library.
You should get duplicate symbol errors, because dllLoadGamePlugin is defined in
GameCollisionComponent/main.cpp
GameAnimationComponent/main.cpp
and all other plugins.
Did you put them into a namespace or rename them?
If so, you can entirely skip the dynamic loading, but you have to make sure that you
call the GameAnimationComponent::dllLoadGamePlugin function "manually".

Or did I miss your question?


Top
 Profile  
Reply with quote  
PostPosted: 03.08.2010, 10:05 
Offline

Joined: 15.02.2009, 02:13
Posts: 161
Location: Sydney Australia
Hi AlexL thanks for your reply.

Yeah I stepped back a bit and had a nice think about it. The symbols would conflict you're right, I could've wrapped it in a namespace which would've been better, but instead I made #ifdefs with renamed function calls and made headers for the plugin system to use instead, and called those 4 kinds inside of GamePlugInManager.app and removed the need for DynLib entirely.

I haven't tried compiling yet, I thought I'd tackle that first and then see if I can compile it.

_________________
-Alex
Website


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 21 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group