Path: utzoo!utgpu!utstat!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!uunet!stan!claire From: claire@Solbourne.COM (Claire Campbell) Newsgroups: comp.windows.x Subject: Xt Initialization Message-ID: <1989Nov14.233038.21326@Solbourne.COM> Date: 14 Nov 89 23:30:38 GMT Organization: Solbourne Computer, Inc. Lines: 34 I have a question regarding initialization of Xt. I have seen the comment "The semantics of calling XtToolkitInitialize more than once are undefined", and am wondering why this is. I have a library which may use Xt widgets as input devices. An application which uses this library may or may not also be using Xt widgets. My problem comes in the case that both the application and the library use Xt widgets (i.e. they both make calls to XtAppInitialize). Is there a way to find out if the toolkit has already been initialized? (In that case I would have to have my own XtAppInitialize() which would be the same minus the call to XtToolkitInitialize, I guess?) In looking at the code, I found that most of the routines that XtToolkitInitialize calls maintain a static 'initialized' variable so that repeated calls have no affect. However, two routines, XrmInitialize() and _XtEventInitialize() do not. In my case, it appears that repeatedly calling _XtEventInitialize() is the problem. I have gotten my application and library to work together successfully by adding the static 'initialized' check to XtToolkitInitialize itself. However, I am not familiar enough with Xt to know if this is safe, legal, smart, etc. Another solution would be for my application to 'let the library know' if it will be doing the toolkit initialization, but if there's a built in way of finding out, I'd like to know about it. Thanks for any help! Claire Claire Campbell Solbourne Computer, Inc. claire@solbourne.com (303) 772-3400 ...{uunet,boulder,sun}!stan!claire