SIGSEGV with PxLoadImage()

As the topic states:

PxLoadImage("/path/to/my/bmp/mypic.bmp", NULL);


The documentation states it should load my bmp fine.
It did in QNX4.x :stuck_out_tongue: And it should do in QNX6.x.
I already looked out for similar topics, but they all just have compiler/linker warnings.
The app compiles and links very nice, no warning/errors at all,
but the PxLoadImage() just SIGSEGV´s at find_object_stat() 0x08244764 in PxLoadImage().
The file is present, has right now rights of 777 (…), can be viewed with pv, is not on a linked dir ;P, the #defines are set for the image support (where i do not see them any more needed) …

Any ideas?

As mentioned by mario on another Thread, this may be caused due to -fpack-struct.

I´ll check this an report

This seems not to be due to the -fpack-struct.
But it does SIGSEGV with just the picture as argument.

PhImage_t * PxLoadImage( char *filename,
PxMethods_t *methods );

typedef struct pxmethods
int flags;
void *(*px_alloc)( long nbytes, int type );
void *(*px_free)( void *memory, int type );
void *(*px_error)( char *msg );
void *(*px_warning)( char *msg );
void *(*px_progress)( int percent );
PhDim_t scale;
void *colors;
int ncolors;
} PxMethods_t;
So… if you want load image, you must at all fill void *(px_alloc)( long nbytes, int type ) member of this struct (for example this function must be: return(malloc(nbytesf(type))) ).
If You set this struct pointer to NULL, function try to place loaded image to NULL so SIGSEGV.

It works fine with NULL generally.

A pointer to a PxMethods_t structure that lets you modify the behavior of the function; see below.
If this argument is NULL, the function loads the graphic file specified by filename.

I also tried a mini-app and it loads fine :slight_smile:

I´ll try putting a loadfunction, just for the case :stuck_out_tongue_winking_eye:

What is mean?
“If this argument is NULL, the function loads the graphic file specified
by filename.”
Where PxLoadImage() store loaded data?
Maybe you need to increasing the draw buffer size?

On QNX4.25 the framework itself allocated data. Only with freeing you had to be a bit careful.
Still implementing with methods :slight_smile:

Done implementing with methods → SIGSEGV at find_object_stat() 0x08244764 in PxLoadImage()

But there seems to be an non-harmful error before, i still work on checking if this is causing the sigsegv

Maybe “/path/to/my/bmp/mypic.bmp” has non compatibility format, try to load this BMP in “pv”, or create it by some Photon utility.

I checked up on a lot of things. The file is readable, in a sample app with the same call to pxloadimage.

Somehow in the big App it just won´t work.
PxLoadImage() calls
px_load_pi_lib() calls
dlopen() ??? y ever this is called, calls
find_object() calls
find_object_stat() and SIGSEGV

I forgot to state,
i do not have any of the


files, but they are located in /lib/dll
and quite a lot in /usr/qnx630/target/qnx6/$(SYSTEM)/lib/dll/

Maybe in your big app you out of stack? Try to increase it…

changing size did not bring any other result :frowning:

It sill complains about a Map-Error of a Fault Page.

But i still do not get the mistake i guess i made.

Try “QNX memory analisys” on your big app…