Re: Tcl dumps when creating string rep for custom type
- From: Don Porter <dgp@xxxxxxxxxxxxxx>
- Date: 21 Oct 2005 12:43:40 GMT
Anders Moe wrote:
> I've registered my own type using Tcl_RegisterObjType,
....
> set g [test] ; # test is the command used to create the object
> puts $g ; # OK - creates a string rep, works fine
> set g oo ; # DUMPS
....
> void update_string_repr (Tcl_Obj* obj)
> {
> char* c = "test string\0";
> obj->bytes = c;
> obj->length = strlen (c);
> }
Let's review the Tcl_RegisterObjType documentation:
The updateStringProc member...
... Storage for the byte array must be allocated in
the heap by Tcl_Alloc or ckalloc. ...
Note that your code does not do what the docs require.
--
| Don Porter Mathematical and Computational Sciences Division |
| donald.porter@xxxxxxxx Information Technology Laboratory |
| http://math.nist.gov/~DPorter/ NIST |
|______________________________________________________________________|
.
- References:
- Tcl dumps when creating string rep for custom type
- From: Anders Moe
- Tcl dumps when creating string rep for custom type
- Prev by Date: Re: failure in: expr $a ne $b
- Next by Date: After problem under Windows
- Previous by thread: Tcl dumps when creating string rep for custom type
- Next by thread: After problem under Windows
- Index(es):
Relevant Pages
|