Swig typemaps and me == bananas - can't override a previous %apply

Brad Clements bkc at Murkworks.com
Mon Jul 19 11:59:34 EDT 1999


I'm encapsulating Novell's NDS API using swig 1.1-685. So far it's going
well and I have about 177 functions wrapped.

One annoying problem I have is figuring out which typemap has been applied
for a particular function. There doesn't seem to be any debug output that
will say something like:

int NWDSLogin(
    NWDSContextHandle context,  /* %apply NDSContext ndscore.i line 77 */
   pnstr8 userid,    /* %apply char *OUTPUT ndsmap.i line 128 */
)

For example, I have this in a .i file

----
%apply STRINGOUT {pnstr8 canonName};
%apply char *INPUT {pnstr8 objectName};

NWDSCCODE
NWDSCanonicalizeName
(
   NWDSContextHandle context,
   pnstr8            objectName,
   pnstr8            canonName
);
------

The above doesn't work. objectName is treated as in output parameter
(STRINGOUT is applied to it).

To make this work, I had to do this:
---
%apply STRINGOUT {pnstr8 canonName};

NWDSCCODE
NWDSCanonicalizeName
(
   NWDSContextHandle context,
   pnstr8            INPUT, /*  objectName, */
   pnstr8            canonName
);
---

Anyone have any ideas on why I can't override the typemap? I've tried adding
this before the function:

%clear STRINGOUT;
%clear STRINGOUT;
%clear pnstr8;
%clear pnstr8;


But that doesn't help. (I saw in the source some mention that typemaps are
stacks that are pushed on %apply and pop'd on %clear)

Does anyone have patches to swig that will produce better diagnostic output
to see how typemaps are applied?

Thanks,

--
Brad Clements,
bkc at murkworks.com






More information about the Python-list mailing list