c++ class-method & Tcl_CreateCommand 
Author Message
 c++ class-method & Tcl_CreateCommand


  In a message on 5 Mar 1996 13:48:43 -0700, wrote :

EG> C++ methods implicitly take an extra "this" pointer argument.  Thus,
EG> in order to invoke a method you really need two pointers: one to the
EG> object and another to the method (static methods don't need "this" and
EG> can be used much like C procedures).
EG>
EG> What I do (for itcl 2.0) is use generic c call backs that then use hash
EG> tables which map itcl object names to object instance pointers and, for
EG> each object class, method names to method pointers.  This is not particularly
EG> elegant nor efficient (since I'm doing the same hash lookups in my tables
EG> that itcl is doing in its tables) but it does allow me to create "natural"
EG> (ie: inheritable) itcl interfaces to C++ classes in a relatively simple
EG> manner.  
EG>

I do something similar: I use the "Handle" extension of TclX to generate
instance names and associate them with Tcl_CreateCommand() with ClientData ==
this pointer value.  See my code for Home Librarian and Role Playing database
packages for details.  I also have a method for actually implementing the
method functions for the class that is called be a static stub C function than
casts the ClientData pointer to the correct class type and then launches the
Tcl processing method.


EG> >Is there a way to use a class-method as the function-parameter of
EG> >Tcl_CreateCommand ? At the time I use a workaround. I create the command with a
EG> >normal c-function and this c-function calls the method of the object.
EG> >
EG> >================================================================================
EG> >  Peter Schartner        Royal Holloway        |    University of Technology
EG> >                   University of London     |          Graz, Austria      
EG> >  

EG> >  PGP key available on request
EG> >================================================================================
EG> >
EG>
EG>
EG> --

EG>
EG>                                                                                                                    

--
                                     \/

http://www.*-*-*.com/ ~heller  ||FidoNet:    1:321/153
http://www.*-*-*.com/ ;/\



Wed, 26 Aug 1998 03:00:00 GMT  
 c++ class-method & Tcl_CreateCommand
I use Tcl_CreateCommand to create new commands in C. Those commands are used as callbacks ; what I would like to do is having the same fonctionalities than with an
"exec",  detaching the process in order to keep the interface happily running.

There is very little information in the books i have about the use of subprocesses; and it is relevant to subprocess created by exec and open.

Of course i am looking for a very general mecanisn, sort of a Tcl_CreateSeparableCommand, but any exemple will be very welcome...Thanks.



Tue, 01 Sep 1998 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. c++ class-method & Tcl_CreateCommand

2. Definining C++ class methods in external .ASM (OBJ) files

3. Tcl_CreateCommand and C++

4. Q: Again: Tcl_CreateCommand() and MS Visual C++

5. Help: Tcl_CreateCommand() and MS Visual C++

6. Classes & Methods

7. Soundformat class & method

8. methods & 1st class messages

9. accessing a instance method from a class method

10. How do I call a method from another method within the same class

11. Class methods vs Instance methods

12. Class method vs instance method???

 

 
Powered by phpBB® Forum Software