Call to XtIsSubclass(w, xmComboBoxWidgetClass) is failing in RHEL

38 views Asked by At

I am migrating a module from Solaris to RHEL 7.9 which uses X motif for building the UI.

After the migration, the call to - XtIsSubclass(w, xmComboBoxWidgetClass) is failing

where w is the Combo box widget.

the call is available through a macro in /usr/include/Xm/ComboBox.h

#define XmIsComboBox(w) XtIsSubclass(w, xmComboBoxWidgetClass)

xmComboBoxWidgetClass is declared in the same file above the macro.

I was able to see the string "xmComboBoxWidgetClass" in /usr/lib/libXm.so.4.0.4

/usr/lib> strings libXm.so.4.0.4 | grep -w "xmComboBoxWidgetClass" xmComboBoxWidgetClass

I have no clue, why the comparison is failing. Any pointer to a possible solution would be very helpful

1

There are 1 answers

0
PaulB On

The following example was compiled and run to exercise the library call.

Here is a sample code:

#include <Xm/Text.h>
#include <Xm/ScrolledW.h>
#include <Xm/ComboBox.h>

int main(int argc, char** argv)
{
    XtAppContext app;
    Widget topShell;
    Widget combo;

    topShell = XtVaAppInitialize(&app, "App", NULL, 0, &argc, argv, NULL
, NULL);

    combo    = XtVaCreateManagedWidget("combo", xmComboBoxWidgetClass, topShell,
                                           NULL);
    printf("Checking\n");
    if( XmIsComboBox(combo) )
    printf("Yes it is\n");
    XtRealizeWidget(topShell);
    XtAppMainLoop(app);

    return 0;
}

Here is the makefile

CC = cc
CFLAGS = -Wall -Wextra -I/usr/local/include
LIBS = -lXm -lXt -lX11
LDFLAGS = -L/usr/local/lib

SRCS = main.c
OBJS = $(SRCS:.c=.o)
TARGET = test

all: $(TARGET)

$(TARGET): $(OBJS)
    $(CC) $(CFLAGS) $(LDFLAGS) -o $(TARGET) $(OBJS) $(LIBS)

%.o: %.c
    $(CC) $(CFLAGS) -c $< -o $@

clean:
    rm -f $(OBJS) $(TARGET)

Running the above...

$ ./test
Checking
Yes it is