in reply to Re: Apache, mod_perl, C++, XS and Shared Memory
in thread Apache, mod_perl, C++, XS and Shared Memory

Can you be more specific?

The module's XS file has a prototype function declation

int get_registration_status();

which is implemented in my c++ file

int get_registration_status () { return RegisterGetStatus(); }

The "RegisterGetStatus" is the function that is part of the static linked lib. The only error I get reported is that the return code is not the one I expected. No messages in apache's error log nor from mod_perl or anything.

As I've already stated I can't debug this lib (maybe because I don't know how to do it ;-). Am I able to trace or debug into the lib when it's compiled without debug information?

Is there any difference in how mod_cgi and mod_perl handle the access to shared memory segments?

Replies are listed 'Best First'.
Re^3: Apache, mod_perl, C++, XS and Shared Memory
by cdarke (Prior) on Sep 08, 2010 at 07:23 UTC
    If the module is not giving you any useful error information then you have several courses of action. You should consult the documentation for the module. If that is unhelpful then contact the supplier. Otherwise you are reduced to tracing the kernel calls.

    Tracing the kernel calls should give you the exact errors and object names if the problem is related to permissions, as you suspect. You will need a tool such as truss (on Sun) or strace (on Linux, and others). Display the process PID ($$), or write it to a file, then pause your process just before the shared object is created. Then attach truss or strace to the process using the -p option. You will need to be signed on as the same userid, or root. Now allow the application to continue. Once you get sufficient information then kill the truss/strace using <CTRL>C. If there is too much data output (and there often is) then use the -o option to save it to a file for later analysis.