By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,209 Members | 1,706 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,209 IT Pros & Developers. It's quick & easy.

best way to implement dynamic design

P: n/a
hey all,

I'd like to implement an application that is truly dynamic: the
components are not only just known at runtime, but also the components
are unknown at runtime: ie: some don't even ship with the application.

When a new component is shipped, the application 'picks up' that
component and drops it in to the interface (in this case a GUI button
as well as an associated class with that gui buttion). The application
then uses the code in that interface to customize the behaviour of the
application.

Sort of like a 'skin' - except instead of having external data
customizing the look of an application, there is external code
customizing the *behaviour* of an application. However, since there

Also, I need this to be cross-platform so, if there is no internal
solution to this problem (the language doesn't support it) I'm
interested in solutions that work on MacOSX/Linux/Win. I'm using
wxWindows as my GUI platform.

Or - should I maybe go with wxPython instead?

jon
Jul 19 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
tt*******@yahoo.com (jonathan) wrote in message news:<f0**************************@posting.google. com>...

This is an ISO C++ newsgroup, which doesn't even support GUIs, let
alone loading arbitrary code at run-time (which some systems do not
support).

Then again, I'm not sure if there *is* a forum for this, so I'll start
rambling so that you have some stuff to look up, at least.

Anyone interested only in ISO C++ should probably stop reading now. :)
I'd like to implement an application that is truly dynamic: the
components are not only just known at runtime, but also the components
are unknown at runtime: ie: some don't even ship with the application.
There must be, at least, a published interface/protocol so that you
can ask the module what it can do and how to get it to do that.
Also, I need this to be cross-platform so, if there is no internal
solution to this problem (the language doesn't support it) I'm
interested in solutions that work on MacOSX/Linux/Win. I'm using
wxWindows as my GUI platform.
Java apps use a feature called "reflection" for this purpose; but C++
doesn't support anything like reflection (yet), so this has to be done
by the programmer. Further, ISO C++ doesn't support dynamic modules,
since not all systems support dynamic modules (ISO C++ is designed to
run on just about any computer). So, you're left with OS-specific
technologies.

On Windows, COM and ActiveX are commonly used for this sort of thing.
On Linux, GNOME uses Bonobo, which is a CORBA-based technology; and
KDE uses KParts.

I have no idea about MacOS X. :) Maybe, if you're lucky, one of the
Linux technologies is also portable there.

You might be able to use one or more of these technologies, perhaps
using different ones on different platforms. Alternatively, it may be
possible to write your own component architecture, but such will be
non-trivial (for a place to start, look up LoadLibrary on Windows and
dlopen on Linux [and possibly MacOS X via its FreeBSD heritage]).
Or - should I maybe go with wxPython instead?


That sounds like the easiest way to do it, if that'll work for you. It
certainly makes sense to use a dynamic language like Python to add
dynamic behavior to a program.

In fact, you might be able to write the program and modules in C++ and
use Python to glue them together -- those wacky people at boost.org
have a C++/Python reflection library, which may be of some use here.
It officially supports Windows and Linux, but it may be portable to
MacOS X if someone (you?) makes it happen.

I have no idea if any of this is relevant to you, but hopefully it'll
lead you in the right direction.

Good luck!

- Shane
Jul 19 '05 #2

P: n/a
jonathan wrote:
Did you have a C++ question?

Please read the Welcome message:

http://www.slack.net/~shiva/welcome.txt

-Kevin

Fair enough, but I maintain that what I asked in fact *was* a C++
question - it dealt with the limitations of the language. The extra
stuff (about guis, etc.) is just context.


I don't really see a question about C++. The whole thing with drop-in
components can't possibly be done in standard C++ since there's no
concept of dynamic linking or anything like that. Unless maybe the
components were interpreted by the main app somehow.

-Kevin
--
My email address is valid, but changes periodically.
To contact me please use the address from a recent posting.

Jul 19 '05 #3

P: n/a
jonathan wrote:
Did you have a C++ question?

Please read the Welcome message:

http://www.slack.net/~shiva/welcome.txt

-Kevin


Fair enough, but I maintain that what I asked in fact *was* a C++
question - it dealt with the limitations of the language. The extra
stuff (about guis, etc.) is just context.


In this case, the answer is "what you want cannot be done".

Jul 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.