More PxLoadImage questions...

I know questions regarding PxLoadImage have been answered several times, but
I still have not found the definitive reponse I’m looking for. Here are my
questions wrt QNX 6.2.0:

  1. It states in the documentation regarding phexlib: “These functions are
    only supplied in static form in the Photon library phexlib. You’ll neex to
    link with them specifically.” Yet in a simple PxLoadImage example I had the
    following results:

compiled with: result:
-Bstatic libphexlib.a seg. viol. binary >500k
-Bstatic libphexlib.so seg. viol. binary >500k
-Bstatic phexlib seg. viol. binary >500k
-Bdynamic libphexlib.so okay, libphexlib.so.2 appears in pidin mem,
binary 30k
-Bdynamic libphexlib.a okay, libphexlib does not appear in pidin mem,
binary 32k

Please explain.

  1. The requirement for an external library is confusing also. When
    compiled with -Bdynamic libphexlib.so, the .so is required in the
    LD_LIBRARY_PATH path. When compiled with -Bdynamic libphexlib.a, the
    phexlib library is not required. What is -Bdynamic doing with the .a
    library, and why are the binaries so significantly different in size?

  2. In a previous examples the ever-so-crucial #define header identified the
    pi_io_ modules we want. However, regardless of what SUPPORT’s I use, or
    if I use them at all, my binary always loads any available pi_io
    .so
    libraries (as shown by pidin mem). What is going on with these #defines?

#define PX_IMAGE_MODULES // define the modules we want
#define PX_GIF_SUPPORT
#define PX_JPG_SUPPORT
#define PX_PCX_SUPPORT
#define PX_BMP_SUPPORT

#include <photon/PxImage.h>

Thanks in advance,
Mike Kadour

Any QNX folk care to take a shot at this?

Cheers,
Mike


Michael J. Kadour

B.A.Sc. Electrical Engineering, University of Waterloo

D.Phil. Candidate Engineering Science, University of Oxford

6 Bradmore Rd. Basement Flat

Oxford, OX2 6QN, UK




“Mike Kadour” <mjkadour@uwaterloo.ca> wrote in message
news:b5un7p$1dc$1@inn.qnx.com

I know questions regarding PxLoadImage have been answered several times,
but
I still have not found the definitive reponse I’m looking for. Here are
my
questions wrt QNX 6.2.0:

  1. It states in the documentation regarding phexlib: “These functions are
    only supplied in static form in the Photon library phexlib. You’ll neex
    to
    link with them specifically.” Yet in a simple PxLoadImage example I had
    the
    following results:

compiled with: result:
-Bstatic libphexlib.a seg. viol. binary >500k
-Bstatic libphexlib.so seg. viol. binary >500k
-Bstatic phexlib seg. viol. binary >500k
-Bdynamic libphexlib.so okay, libphexlib.so.2 appears in pidin mem,
binary 30k
-Bdynamic libphexlib.a okay, libphexlib does not appear in pidin mem,
binary 32k

Please explain.

  1. The requirement for an external library is confusing also. When
    compiled with -Bdynamic libphexlib.so, the .so is required in the
    LD_LIBRARY_PATH path. When compiled with -Bdynamic libphexlib.a, the
    phexlib library is not required. What is -Bdynamic doing with the .a
    library, and why are the binaries so significantly different in size?

  2. In a previous examples the ever-so-crucial #define header identified
    the
    pi_io_ modules we want. However, regardless of what SUPPORT’s I use, or
    if I use them at all, my binary always loads any available pi_io
    .so
    libraries (as shown by pidin mem). What is going on with these #defines?

#define PX_IMAGE_MODULES // define the modules we want
#define PX_GIF_SUPPORT
#define PX_JPG_SUPPORT
#define PX_PCX_SUPPORT
#define PX_BMP_SUPPORT

#include <photon/PxImage.h

Thanks in advance,
Mike Kadour
\

Hello Mike,

I believe I know what is going on …

It is my understanding that PxLoadImage uses plugins
now, using dlopen to access them. If you link static,
the dlopen will cause a core dump. So in order to use
PxLoadImage, you must link dynamically. See below.

Mike Kadour <mjkadour@uwaterloo.ca> wrote:

Any QNX folk care to take a shot at this?

Cheers,
Mike


Michael J. Kadour

B.A.Sc. Electrical Engineering, University of Waterloo

D.Phil. Candidate Engineering Science, University of Oxford

6 Bradmore Rd. Basement Flat

Oxford, OX2 6QN, UK



“Mike Kadour” <> mjkadour@uwaterloo.ca> > wrote in message
[snip]
2. The requirement for an external library is confusing also. When
compiled with -Bdynamic libphexlib.so, the .so is required in the
LD_LIBRARY_PATH path. When compiled with -Bdynamic libphexlib.a, the
phexlib library is not required. What is -Bdynamic doing with the .a
library, and why are the binaries so significantly different in size?

I think it is libc that is the culprit here. Since -Bdynamic is on
your link line, and libc is the last (or one of the last) linked, you
will get the .so . If you use -Bstatic, the static libc will be used,
resulting in a core dump when libphexlib/libphimg tries to use dlopen.

  1. In a previous examples the ever-so-crucial #define header identified
    the
    pi_io_ modules we want. However, regardless of what SUPPORT’s I use, or
    if I use them at all, my binary always loads any available pi_io
    .so
    libraries (as shown by pidin mem). What is going on with these #defines?

This I do not have an answer for.

#define PX_IMAGE_MODULES // define the modules we want
#define PX_GIF_SUPPORT
#define PX_JPG_SUPPORT
#define PX_PCX_SUPPORT
#define PX_BMP_SUPPORT

#include <photon/PxImage.h

Thanks in advance,
Mike Kadour

You were definitely on the right track!

With regards to phexlib, despite the docs both static and dynamic libs are
available, and you can link statically or dynamically as you choose. (and
yes, Derek was right, the static link to libc was my problem). It is of
course the pi_io_*.so that is loaded at run-time (ie, not static nor
dynamic) by phexlib.

With regards to the use of the #define PX_IMAGE_MODULES, I’m still at a
loss.

Cheers,
Mike



It is my understanding that PxLoadImage uses plugins
now, using dlopen to access them. If you link static,
the dlopen will cause a core dump. So in order to use
PxLoadImage, you must link dynamically. See below.

  1. The requirement for an external library is confusing also. When
    compiled with -Bdynamic libphexlib.so, the .so is required in the
    LD_LIBRARY_PATH path. When compiled with -Bdynamic libphexlib.a, the
    phexlib library is not required. What is -Bdynamic doing with the .a
    library, and why are the binaries so significantly different in size?

I think it is libc that is the culprit here. Since -Bdynamic is on
your link line, and libc is the last (or one of the last) linked, you
will get the .so . If you use -Bstatic, the static libc will be used,
resulting in a core dump when libphexlib/libphimg tries to use dlopen.