On Thu, 18 Jan 2007 09:45:37 +0800, Paul Pluzhnikov
<[EMAIL PROTECTED]> wrote:
William <[EMAIL PROTECTED]> writes:
for example, I have a global object:
extern Object myobj;
Can gcc get this object by using string "myobj" at runtime??
I know C++ rtti doesnt support this,
but I dont know if gcc can ,
Gcc can't either; but if your platforms has dlsym(3) or its equivalent,
and if the code was compiled and linked with appropriate flags
(which are platform-specific), then you can lookup symbols by name
at runtime.
If you have control over "Object", a much more portable solution
is to have objects "register" themselves in some global map, in
which you can later look them up.
Cheers,
thanks, i am now using the 'register solution' and want to get a better
way.
_______________________________________________
help-gplusplus mailing list
help-gplusplus@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gplusplus