Pt_ARG_SCROLL_POSITION fails?

The following program fails to read Pt_ARG_SCROLL_POSITION from a
PtScrollbar. It is a simplification of a code fragment that works in
Photon 1.14 but fails in Photon 2. Any ideas why?

/* Compile with:
gcc -Wall dtest.c -o dtest -lphoton
*/

#include <stdio.h>
#include <Pt.h>

int main (int argc, char **argv)
{
int *pos=NULL;
PtWidget_t *w, *s;
PtArg_t args[5];

PtInit (NULL);

w = PtCreateWidget (PtWindow, NULL, 0, NULL);
PtSetArg (&args[0], Pt_ARG_SCROLL_POSITION, 10, 0);
s = PtCreateWidget (PtScrollbar, NULL, 1, args);
PtRealizeWidget (w);
PtSetArg (&args[0], Pt_ARG_SCROLL_POSITION, &pos, 0);
PtGetResources (s, 1, args);

if (pos == NULL)
printf (“Photon PtScrollbar PT_ARG_SCROLL_POSITION bug.\n”);
else
printf (“The scroll position is %d\n”, *pos);

PtMainLoop();
return (0);
}

Previously, Andrew Thomas wrote in qdn.public.qnxrtp.photon:

The following program fails to read Pt_ARG_SCROLL_POSITION from a
PtScrollbar. It is a simplification of a code fragment that works in
Photon 1.14 but fails in Photon 2. Any ideas why?

Wojtek solved this in another thread.

/* Compile with:
gcc -Wall dtest.c -o dtest -lphoton
*/

I was using -lphoton instead of -lph. The bug is limited to the 1.14
-lphoton library. Works fine in -lph.

Thanks,
Andrew

Andrew Thomas <Andrew@cogent.ca> wrote:

Previously, Andrew Thomas wrote in qdn.public.qnxrtp.photon:
The following program fails to read Pt_ARG_SCROLL_POSITION from a
PtScrollbar. It is a simplification of a code fragment that works in
Photon 1.14 but fails in Photon 2. Any ideas why?

Wojtek solved this in another thread.

/* Compile with:
gcc -Wall dtest.c -o dtest -lphoton
*/

I was using -lphoton instead of -lph. The bug is limited to the 1.14
-lphoton library. Works fine in -lph.

The bug does not exist. Pt_ARG_SCROLL_POSITION has a different value in
1.14. I’m surprised you didn’t get more serious problems if you
compiled with Photon 2 headers and then linked with Photon 1 libs…


Wojtek Lerch (wojtek@qnx.com) QNX Software Systems Ltd.

Previously, Wojtek Lerch wrote in qdn.public.qnxrtp.photon:

Andrew Thomas <> Andrew@cogent.ca> > wrote:
Previously, Andrew Thomas wrote in qdn.public.qnxrtp.photon:
The following program fails to read Pt_ARG_SCROLL_POSITION from a
PtScrollbar. It is a simplification of a code fragment that works in
Photon 1.14 but fails in Photon 2. Any ideas why?

Wojtek solved this in another thread.

/* Compile with:
gcc -Wall dtest.c -o dtest -lphoton
*/

I was using -lphoton instead of -lph. The bug is limited to the 1.14
-lphoton library. Works fine in -lph.

The bug does not exist. Pt_ARG_SCROLL_POSITION has a different value in
1.14. I’m surprised you didn’t get more serious problems if you
compiled with Photon 2 headers and then linked with Photon 1 libs…

I’m going to plead a little ignorance here. I didn’t know there
were Photon 1.14 libraries on the system, and I have no clue how to
differentiate the Photon 2 headers from the Photon 1 headers, since
the Photon 2 headers have the same names as the Photon 1 headers, and
the Photon 1 libraries have the same names in Photon 2 that they did
in Photon 1. This means that if I just copy code from Photon 1 to
Photon 2 and compile it, I will by default get Photon 1 libraries with
Photon 2 headers. This is a trick, right?

Cheers,
Andrew

Welcome to the club… It took me two months to find out I’m linking to the
wrong library (that in the early days of QNX6 - it looked like the stuff
that didn’t work was caused by Photon bugs). Finally I posted my makefile
and somebody from QSSL helped me on the right track.
Actually, it works surprisingly pretty well (using 2.0 headers and linking
to 1.14 libs). I think there are no 1.14 headers anywhere. It is not very
intuitive why the 1.14 libs are still there, but I’m sure there is a reason
for it. Is it???
Markus


“Andrew Thomas” <Andrew@cogent.ca> wrote in message
news:Voyager.010209101643.67985456A@andrewhome.cogent.ca

Previously, Wojtek Lerch wrote in qdn.public.qnxrtp.photon:
Andrew Thomas <> Andrew@cogent.ca> > wrote:
Previously, Andrew Thomas wrote in qdn.public.qnxrtp.photon:
The following program fails to read Pt_ARG_SCROLL_POSITION from a
PtScrollbar. It is a simplification of a code fragment that works in
Photon 1.14 but fails in Photon 2. Any ideas why?

Wojtek solved this in another thread.

/* Compile with:
gcc -Wall dtest.c -o dtest -lphoton
*/

I was using -lphoton instead of -lph. The bug is limited to the 1.14
-lphoton library. Works fine in -lph.

The bug does not exist. Pt_ARG_SCROLL_POSITION has a different value in
1.14. I’m surprised you didn’t get more serious problems if you
compiled with Photon 2 headers and then linked with Photon 1 libs…

I’m going to plead a little ignorance here. I didn’t know there
were Photon 1.14 libraries on the system, and I have no clue how to
differentiate the Photon 2 headers from the Photon 1 headers, since
the Photon 2 headers have the same names as the Photon 1 headers, and
the Photon 1 libraries have the same names in Photon 2 that they did
in Photon 1. This means that if I just copy code from Photon 1 to
Photon 2 and compile it, I will by default get Photon 1 libraries with
Photon 2 headers. This is a trick, right?

Cheers,
Andrew

Markus Loffler <loffler@ces.clemson.edu> wrote:

Welcome to the club… It took me two months to find out I’m linking to the
wrong library (that in the early days of QNX6 - it looked like the stuff
that didn’t work was caused by Photon bugs). Finally I posted my makefile
and somebody from QSSL helped me on the right track.
Actually, it works surprisingly pretty well (using 2.0 headers and linking
to 1.14 libs). I think there are no 1.14 headers anywhere. It is not very
intuitive why the 1.14 libs are still there, but I’m sure there is a reason
for it. Is it???

It’s for running existing Photon 1.14 apps, for instance vmail.

Perhaps things would be clearer if there was only a “libphoton.so.1” but
no “libphoton.so” – I don’t think the linker would find it then. But I
am not a linker expert…


Wojtek Lerch (wojtek@qnx.com) QNX Software Systems Ltd.