Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!apple!bbn.com!ulowell!hawk.ulowell.edu!kseethar From: kseethar@hawk.ulowell.edu (Krishnan Seetharaman) Newsgroups: comp.windows.x.motif Subject: Re: Need help with Ulowell MotifC++ bindings Message-ID: <1991May17.194521.949@ulowell.ulowell.edu> Date: 17 May 91 19:45:21 GMT References: <15457@arctic.nprdc.navy.mil> Sender: usenet@ulowell.ulowell.edu (News manager) Organization: University of Lowell Computer Science, Lowell MA Lines: 55 In article <15457@arctic.nprdc.navy.mil> apple@nprdc.navy.mil (Jim Apple) writes: > > I need some help with the Ulowell C++ bindings for Motif. > >My problem is that I can not pass a object (XMObject) as a argument >to a function that is in another source file. > > here is a short fragment of what I'm trying to do > >----- main.cc >. >void CreateMainMenu( XMForm * ); >// I've also tried, void CreateMainMenu( XMObject * ); > >void main (unsigned int argc, char **argv) >{ > XMApplicationShell topLevel ("topLevel", &argc, argv ); > XMForm mainWindow (&topLevel, "mainWindow" ); > CreateMainMenu( &mainWindow ); >} > >----- menus.cc > >void >CreateMainMenu( XMForm * parent ) >{ > XMString string ( "test" ); > XMLabel label ( parent, "label", &string ); > label.Manage(); >} > >The mainWindow is displayed but I get a message "Destroying Widget ..", >and the label is never displayed > >If I move the three lines from CreateMainMenu to main.cc and replace "parent" >with "&mainWindow", it works fine. > >GDB show main.cc:&mainWindow and Menus.cc:parent to be the same address Hi I tried out the above program and the fix seems to be to put declare the variables in the other file as static. Hope this helps ... Regards Krishnan -- K. Seetharaman | email : kseethar@cs.ulowell.edu Graphics Research Laboratory, | Tel : 508-934-3612 Department of Computer Science | University of Lowell, Lowell, MA 01854 |