On Tuesday, May 6, 2003, at 05:47 AM, Jim Freeze wrote: > Ok, I have been reading the swig docs and I have > a few questions. Other than the code above looking > totally greek to me, the swig manual does its > best to convince me that I never want to write > a typemap. So, why do we have to write a typemap > for something so common as char **? Is it because > I said that I wanted to call dbInit as: > > dbInit(n, "some string") > > instead of > > dbInit(n, ["some string"]) ? In a nutshell, yes. Basically, the C data structures used by your application, in this case Cadence's itkDB, do not (or may not) map to ruby objects in a manner you will find convenient or natural to use. For example, itkDB has places it returns *dbPathStyle as an output. Without special typemaps, these come back into Ruby as a generic object that we can pass around, but not really know what the value is. In C, the results points to an integer so we have a typemap that tells swig how to map this type to a ruby Fixnum %typemap(ruby,argout) dbPathStyle *OUTPUT ... > Second question, do I need to learn how to write typemaps? Eventually, yes. > Fourth: Lyle, thanks for all your expert help. I'd like to thank Lyle for his work on the whole Ruby/SWIG! Jeff.