Operating System - HP-UX
1753783 Members
7113 Online
108799 Solutions
New Discussion

Re: Runtime unsats with a simple aC++ shlib as Apache plugin

 
Biswadeep
Advisor

Re: Runtime unsats with a simple aC++ shlib as Apache plugin

Can you please elaborate on the use of "tusc" command with context to our problem statement with the help of an example or what command I should use and how

 

I am new to using "tusc"command.So not fully aware of its usage.

 

So a little elaboration  from your side would be more helpful in understanding the concepts.

 

Thanks

Dennis Handly
Acclaimed Contributor

Re: Runtime unsats with a simple aC++ shlib as Apache plugin

>Can you please elaborate on the use of "tusc" command with context to our problem statement

 

The generic tusc is something like:  (you basically had that but in a strange order)

tusc -fp -o tusc.out PID

 

If you want more details on exec and other calls, add: -ea

To get larger buffers for stdout/stderr: -w1,2 -b 128

Biswadeep
Advisor

Re: Runtime unsats with a simple aC++ shlib as Apache plugin

Can  C process accept C++ Shared libraries?

 

Apache is written in purely C and in that we are trying to load a C++ module?

 

Is that the problem for these issues?

 

Dennis Handly
Acclaimed Contributor

Re: Runtime unsats with a simple aC++ shlib as Apache plugin

>Can  C process accept C++ Shared libraries?

 

Only if you follow the process on:

http://h21007.www2.hp.com/portal/download/files/unprot/aCxx/HTML/distributing.htm#linking

 

>Is that the problem for these issues?

 

That was your initial problem you solved in:

http://h30499.www3.hp.com/t5/Languages-and-Scripting/Linking-issues-while-compiling-a-simple-c-module-in-HP-UX/m-p/6550974#M47056

Biswadeep
Advisor

Re: Runtime unsats with a simple aC++ shlib as Apache plugin

Hi,

  Thanks for the help so far. As we have already mentioned we are trying our webservice in both C and C++ seperatley.

 

In C it is working fine but in c++ it is not(not able to call the service through client)

 

In C the call to the service is being done through soap_serve method but in C++ its is done through soap_serve method which  calls the serve method.

 

The compilation process and the generated ".so" is different for both C and C++.

 

We tried the following command


In C code:

nm calc.so|grep soap_serve

 

the output is:


[515]    |   4611686018427867104|   80|FUNC |GLOB |0|   .text|apache_default_soap_serve
[428]    |   4611686018427814096| 656|FUNC |GLOB |0|   .text|soap_serve
[266]    |   4611686018427815520|    1520|FUNC |GLOB |0|   .text|soap_serve_ns__add
[274]    |   4611686018427817488|    1520|FUNC |GLOB |0|   .text|soap_serve_ns__sub
[249]    |   4611686018427814848| 352|FUNC |GLOB |0|   .text|soap_serve_request

 

The code works fine here.The client returns the desired results.

 

In C++ code:

nm calc.so|grep serve(since soap_serve calls the function serve)

 

the output is :

 

[124]    |   4611686018427623904|    2768|FUNC |LOCAL|0|   .text|_Z13serve_ns__addP11calcService
[125]    |   4611686018427626864|    2768|FUNC |LOCAL|0|   .text|_Z13serve_ns__subP11calcService
[729]    |   4611686018427620992|    1024|FUNC |GLOB |0|   .text|_ZN11calcService5serveEv
[623]    |   4611686018427523808| 176|FUNC |GLOB |0|   .text|apache_default_soap_serve
[570]    |   4611686018427993376| 672|FUNC |GLOB |0|   .text|soap_begin_serve
[516]    |   4611686018427524016|    1280|FUNC |GLOB |0|   .text|soap_serve

 

We can see that it contains both the function add and subtract and name mangling is also taken care of.


Bu in this case client still couldnot call the service and hence unable to get the desired result

 

What can be the reasons?.

 

Apache Server is build in pure C.

All the linking steps in building of c++ shared library is done as per the steps mentioned in the forum by the experts.

 

So the process of loading a C++ shared Library into a C process(i.e Apache) is taken care of by the steps mentioned in the forum.

 

So I dont think that is the issue.

 

What could be the issue now?

 


please help.

Dennis Handly
Acclaimed Contributor

Re: Runtime unsats with a simple aC++ shlib as Apache plugin

>In C it is working fine but in C++ it is not (not able to call the service through client)

 

Is there anyway you can test this out without using Apache?

I.e. dynamically load this into a C program add see if you can call the methods?

Also, can you add printf calls in your C++ functions to see where you get?

 

>We can see that it contains both the function add and subtract and name mangling is also taken care of.

I see mangling, no "taken care of".  Who calls serve_ns__add and serve_ns__sub?

(You do know that is is illegal to use "__" in a user defined name.  That's reserved for the implementation.)

 

>What could be the issue now?

 

No clue.  You need to get the source to Apache and see where the error occurs and what it means.