471,305 Members | 1,250 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,305 software developers and data experts.

how to create a pointer, or is there a better solution ?

hello,

I've a program where users can make modules,
by just dumping them in a certain directory,
then they will dynamically link into the program if needed.

One of the communication channels I use,
is a general global file, which should be imported by all user modules.

One of the things a user should be able to do is to create " global
variables",
which should then be available in all the other program modules.
So the global file contains a list, call JAL_Globals = [],
where each user can append the globals he want to be exposed to the
outside world (for read only).
Now if these globals are complex items, no problem, I get pointers and
can access them.
But if these variables are simple, like integers, I get the value only
once ;-)

How can I create of dynamic pointers, even to simple variables ?
Or is there a better way ?

thanks,
Stef Mientki
Oct 13 '07 #1
1 1097
stef mientki schrieb:
hello,

I've a program where users can make modules,
by just dumping them in a certain directory,
then they will dynamically link into the program if needed.

One of the communication channels I use,
is a general global file, which should be imported by all user modules.

One of the things a user should be able to do is to create " global
variables",
which should then be available in all the other program modules.
So the global file contains a list, call JAL_Globals = [],
where each user can append the globals he want to be exposed to the
outside world (for read only).
Now if these globals are complex items, no problem, I get pointers and
can access them.
But if these variables are simple, like integers, I get the value only
once ;-)

How can I create of dynamic pointers, even to simple variables ?
Or is there a better way ?
Don't use a list, use a dictionary that has names mapped to values. Then
the problem goes away, because instead of mutating an object (which you
still can do), you can also rebind a new one -e.g like this:
JAL_Globals['name'] += 100

Diez
Oct 13 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Jacek Dziedzic | last post: by
52 posts views Thread by Douglas Garstang | last post: by
16 posts views Thread by jose_luis_fdez_diaz_news | last post: by
5 posts views Thread by Soumen | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.