A C++ glue example
Hernan Astudillo R.
hernan at cc.gatech.edu
Sat Feb 13 00:02:46 UTC 1993
I recently had the opportunity to use the Self glue for C++, and
(after some initial bumping) I got to it ok. part of the solution is to use
a newer version of the primitiveMaker, which mercifully Bay sent me.
the use of proxies for C++ glue is not too clear from the manual, but
fortunately it is easy to understand by looking at the stubs generated by the
primitiveMaker. in fact, the altogether different approaches to object
creation in C++ and Self make for some interesting issues. I found myself
trying to fit C++ construction (by secondary effects of global functions)
into Self creation (by cloning of prototypes). this made me think for a
while, consider some alternative ways of representing sub-classes (since my
proxies are pseudo-sub-classes of "proxy"), and pick one based on
representation of sub-classing with composition rather than
copying+modification or asignment to "this".
anyway, i have included in the very next mail, the text of a complete
example of using Self glue to access C++ cons/destructors and members. the
code is liberally commented (methinks), and I considered and left (commented
out) several solutions to the above mentioned creation mismatch problem. I
think that may be useful for trying to define some standard "style". to make
the example useful, I also included a small C++ source file with the class to
be glued, the Self glue template, and the Self source for the proxy functions
(which use the glue).
greetings, and happy delegation!!
Hernan Astudillo R. | "Life is short. Play hard."
hernan at cc.gatech.edu | -- Reebok
College of Computing, Georgia Tech, Atlanta GA 30332 / (404) 853-9390
More information about the Self-interest