C
Christopher Jastram
I'm a self-taught programmer, so this might be a pretty dumb question.
If it is, please point me in the right direction and I shall
apologize profusely.
I have a question regarding C++ and object members. Can anyone help?
I'm writing a C++ wrapper for a fairly old programming interface to a
document editing program that has no OOP whatsoever; only tons of
structs. This program has different callbacks I'm supposed to
implement for different kinds of events, such as open a file, user
changed something, user clicked a custom command button, etcetera.
For structured programming, it's easy. However, I'm having some
trouble with persistence of objects across the different callbacks.
How do I do that?
I had two ideas. One was to create an object that implemented the
callbacks as member functions. That didn't work -- the controlling
program didn't even see the callbacks. (If I could create some sort
of 'alias', could it work?).
Another idea was to create a global static object that I could refer
to within the callbacks, but that didn't really work out at all.
I don't want to go recreating object structures in every callback,
that get recreated every time the callback is executed -- that seems
inefficient to me.
Anybody have any ideas? Hints? Suggestions?
Thanks!
( btw, don't reply to the mailinator.com address.
If you must reply via email, my email addr is:
My email is cej AT i n t e c h . c o m )
Christopher Jastram
Programmer, Technical Instructor
Integrated Technologies, Inc.
If it is, please point me in the right direction and I shall
apologize profusely.
I have a question regarding C++ and object members. Can anyone help?
I'm writing a C++ wrapper for a fairly old programming interface to a
document editing program that has no OOP whatsoever; only tons of
structs. This program has different callbacks I'm supposed to
implement for different kinds of events, such as open a file, user
changed something, user clicked a custom command button, etcetera.
For structured programming, it's easy. However, I'm having some
trouble with persistence of objects across the different callbacks.
How do I do that?
I had two ideas. One was to create an object that implemented the
callbacks as member functions. That didn't work -- the controlling
program didn't even see the callbacks. (If I could create some sort
of 'alias', could it work?).
Another idea was to create a global static object that I could refer
to within the callbacks, but that didn't really work out at all.
I don't want to go recreating object structures in every callback,
that get recreated every time the callback is executed -- that seems
inefficient to me.
Anybody have any ideas? Hints? Suggestions?
Thanks!
( btw, don't reply to the mailinator.com address.
If you must reply via email, my email addr is:
My email is cej AT i n t e c h . c o m )
Christopher Jastram
Programmer, Technical Instructor
Integrated Technologies, Inc.