Updated 2004-07-13 00:40:55 by GPS

George Peter Staplin: This function is used to create a ByteArray object from a structure/pointer/memory. I use it in combination with obj_to_mem.
 /* REVISION 114 */
 #ifndef MEM_TO_OBJ_C
 #define MEM_TO_OBJ_C
 inline Tcl_Obj *
 mem_to_obj ( void *mem, size_t s ) {
  return Tcl_NewByteArrayObj ((unsigned char *)mem, s);
 }
 #endif /* MEM_TO_OBJ_C */

Example usage:
 GC gc;
 /* gc = XCreateGC ... */
 Tcl_SetObjResult (interp, mem_to_obj (&gc, sizeof (GC)));

See also: obj_to_mem