Who can help me ?
I tried to recompile with Linux, a software which was running under
Xwindows
and Motif 1.2 (on a HP Appollo workstation with HP-UX); no problem to
recompile
: 0 errors, 0 warning. But at the run, I got the following error:
segmentation fault
After debugging, I found that it was the XtOpenDisplay() function which
produces
the error (instead of returning NULL).
part of the code is the following:
////////////////////////////////////////////
void Init_XWin(void)
{
Arg args[10];
int ac;
XSetWindowAttributes attributs;
char nom_exec[10];
Widget wMenuPane;
Widget wSousMenuPane;
Widget wMyShell;
char title[80];
/*********** init. XWindow ***************/
XtToolkitInitialize();
AppContext = XtCreateApplicationContext();
dpy= XtOpenDisplay( AppContext, "DISPLAY", "P_EXEC", NULL,NULL, 0, 0,
NULL );
//////////////////////////////////////////
// program never reach this point ! ////////
//////////////////////////////////////////
ac = 0;
XtSetArg( args[ac], XmNwidth, 640+20 );
ac++;
XtSetArg( args[ac], XmNheight, 480+70 );
ac++;
XtSetArg( args[ac], XmNallowShellResize, False );
ac++;
strcpy(title,APPLICATION_NAME);
strcat(title,VERSION_);
XtSetArg( args[ac], XmNtitle,title);
ac++;
XtSetArg( args[ac], XmNiconName, title );
ac++;
sprintf(nom_exec,"THP%d",getpid());
wMyShell = XtAppCreateShell(nom_exec, NULL,
applicationShellWidgetClass,dpy, args, ac );
wMainWindow = XmCreateMainWindow( wMyShell, "wMainWindow", NULL, 0);
... program continues ...
///////////////////////////////////////
here is a part of the makefile showing the libraries
////////////////////////////////////////
#makefile
.... somes includes ...
#----------------------------------------------------------------|
SRC = .
OBJ = ../obj
EXE = ../exe
INC = ../include
#----------------------------------------------------------------|
CFLAGS = -a
-I /usr/X11R6/include/X11 \
-I /usr/X11R6/LessTif/Motif2.0/include \
-I $(INC)
XLIBS = -L /usr/X11R6/lib \
-L /usr/X11R6/LessTif/Motif2.0/lib \
-lXm -lXt -lX11 -lm
... continues ...
$(EXE)/P_EXEC : $(MODULES)
gcc $(MODULES) -o $@ $(XLIBS) $(CFLAGS)
... continues ...
/////////////////////////////////////////
the version of lesstif is 0.90 (lesstif-0.90.0-linux-libc5.tar obtained
on ftp.lesstig.org)
I got the same error with motif 1.2
I have a Suse Linux 6.2 package (kernel 2.2.10)
///////////////////////////////////////////
considering such difficulties, I just tried to compile the "hello world"
program,
the first simplest program given in chapter 2 of volume 4 (p. 36)
of XToolkit Intrinsics programming manual (O'Reilly):
Here is the code:
///////////////////////////////////
#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>
#include <Xm/Xm.h>
int main(int argc , char **argv)
{
XtAppContext app_context;
Widget toplevel, hello;
WidgetClass xmLabelWidgetClass;
String *argv_in;
toplevel= XtVaAppInitialize(
&app_context,
"xhello",
NULL,
0,
&argc,
argv_in,
NULL ,
NULL);
hello = XtCreateWidget("hello",
xmLabelWidgetClass,
toplevel,
NULL,
0);
/////////////////////////////////////////////////////
program never reach this point ! Segmentation fault inside
CreateWidget()
/////////////////////////////////////////////////////
XtRealizeWidget(toplevel);
XtAppMainLoop(app_context);
}
//////////////////////////////////////
first strange thing,during the compilation the functions:
Widget XtVaCreateManageWidget(String, WidgetClass,Widget, ArgList,
Cardinal);
Widget XtCreateManageWidget(String, WidgetClass,Widget, ArgList,
Cardinal);
are unknown in the libraries ! So I replace them by XtCreateWiget(),
maybe is it
the matter ?? Are they really necessary ?
How can I get the appropriate libraries ?
Then I got again a segmentation fault error, during the run, inside the
function XtCreateWidget() (but I have 0 error, 0 warning during
compilation)
Thank you in advance for some help
Dominique