[Gtk-sharp-list] Upcoming problems.
Rachel Hestilow
rachel@nullenvoid.com
27 May 2003 16:33:07 -0500
--=-ZNVpocReCl/xiwer8ysT
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable
On Tue, 2003-05-27 at 11:41, Mike Kestner wrote:
> Surely there are not 162 instances of const char * returns. It seems to
> me like the majority of string returns in gtk are owned by the caller.=20
> We should only be changing the DllImports for those that aren't owned by
> us.
>=20
> So that is going to require an audit of those API calls and some tagging
> in the XML. Otherwise, we are going to leak all the owned strings. It
> should be a pretty small change to the generator to handle a tag like
> that.
>=20
> > I've got some free time so I'll see if I can fix this tonight. Mike, I
> > know you had some more pending changes to the generator, so sorry in
> > advance if I cause any conflicts :-).
>=20
> If you have the time, great. This will most likely be isolated to
> Method.cs, and I don't think I've changed it much, if at all.
>=20
I haven't committed my changes yet, but I think it's actually far
simpler than that for the autogenerated code. Here is what I did:
1) I created a new ConstStringGen class which sets MarshalReturnType to
IntPtr and outputs a call to PtrToStringAuto in FromNativeReturn.
2) I updated SymbolTable to use ConstStringGen for the const-char and
const-gchar cases. I also had to add a small hack in Trim to not remove
the const in this case (as otherwise it would go to the regular string
SimpleGen).
Combined with an audit of the glue, glib, and .custom sources, we're
left with 50 other functions which, on cursory glance, all return new
strings. So no metadata hacking is required.
All in all, I'm impressed with the generator refactoring, the actual
generator modifications only took half an hour. Kudos on the great
design, Mike.
Shall I commit?
-- Rachel
--=-ZNVpocReCl/xiwer8ysT
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)
iD8DBQA+09mRapOJdUj74F4RArYcAJ9H3z+DED+nN8x4i2lADY9qk6M2pACg3FmB
ICKOz/64U8ylLC8DRBWJEqw=
=RbxC
-----END PGP SIGNATURE-----
--=-ZNVpocReCl/xiwer8ysT--