Message-ID: <44BFFCC8.4030607 at rftp.com> Date: Thu, 20 Jul 2006 14:59:36 -0700 From: Robert Roessler Organization: Robert's High-performance Software MIME-Version: 1.0 To: LablGTK List Subject: Re: Selection_mode_val (e.g.) not usable from outside of LablGTK core References: <44BF4A1E.4040307 at rftp.com> In-Reply-To: <44BF4A1E.4040307 at rftp.com> Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Length: 1289 Robert Roessler wrote: > I am unable to use this converter (or any of the ones like it) from my > own DLL (for a new OCaml binding for a C widget) since the tables > themselves needed for the lookups are not directly visible to a foreign > DLL. > > There are several hacks possible in C or Caml code... but none as > convenient as just being able to use Selection_mode_val and its siblings > directly... :( > > What is/are a/some recommendation(s) for the "right" way to do this? Well, to reply to myself, how about this: In the "ml_..." C file of my widget wrapper, I include gtk_tags.h normally. Then I place immediately after it an include of gtk_tags.c (conditionalized on CAML_DLL, of course)? Then I *can* go ahead and use Selection_mode_val et al! Works great - and there is even elegance of a sort in its brutal simplicity... :) And yes, the lookup tables *are* duplicated - but they aren't really that large, are only duped in the CAML_DLL case, and after all, we are talking GTK here (not exactly a trivially-sized runtime). ;) I hope that no one sees holes in this technique, as my next approach involves updating varcc.ml4 to output multiple versions of the lookup macros (also based on CAML_DLL)... Robert Roessler robertr@rftp.com http://www.rftp.com