Path: utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!tut.cis.ohio-state.edu!zaphod.mps.ohio-state.edu!swrinde!cs.utexas.edu!asuvax!ncar!ico!auto-trol!marbru From: marbru@auto-trol.UUCP (Martin Brunecky) Newsgroups: comp.windows.x Subject: Re: Defining Callbacks from resource files Summary: Write a string-to-callback converter Keywords: Converter, Callback Message-ID: <536@auto-trol.UUCP> Date: 20 Dec 89 15:59:41 GMT References: <38@guug.UUCP> <8912191502.AA22891@LYRE.MIT.EDU> <129425@sun.Eng.Sun.COM> Reply-To: ncar!ico!auto-trol!marbru (Martin Brunecky) Organization: Auto-trol Technology, Denver Lines: 27 Writing a String to Callback converter is a trivial thing. Just look at the Intrinsic code for an example. What may NOT be such a trivial thing is making the converter code aware of any callback procedures that the application provides. A simple and portable way to do that are "registration routines". A function called by the application (presumably BEFORE any widgets are created), which hands the callback procedure name(String) and pointer to the converter code (which must implement some sort of callback procedures database - but a simple linked list would work too, unless you want to explore magics of Xrm). Someone may complain that using registeration routines is not very elegant. But since a programmer has to write most of his callbacks, one registration call per callback seems fair to me. For really elegant solution, you need systems which support runtime binding, such as Apollo Aegis, OS/2 - and you can do it even with VMS, and may be (I haven't tried it) with Sun OS. Your application must be shareable image, VMS gives you LIB$FIND_IMAGE_SYMBOL which does exactly what we want - finds a pointer to a named function/procedure. The same thing must be possible on Sun - and may be it's out there, forgive my ignorance. -- ############################################################################### Martin Brunecky, Auto-trol Technology Corporation, 12500 North Washington Street, Denver, CO-80241-2404 (303) 252-2499 ncar!ico!auto-trol!marbru