Hi Alex,
As it says, add,
#ifdef __cplusplus
extern "C"{
#endif
In the top of your file, after including the headers. And, add,
#ifdef __cplusplus
}
#endif
at the very end. This way, you will be able to set extern "C" for all the
methods in the source file.
I too didn't require the LD_PRELOAD when I tried.
Regards,
Senaka.
> Hi Manjula,
>
> Yes, you are right. I removed setting LD_PRELOAD from my script that
> starts the axis server, the test still runs OK.
>
> And yes, I have seen the mention in the Axis2/C FAQ about using
> 'extern "C"'. I just have to suggest that the FAQ mention using
> 'extern "C"' specifically with axis2_get_instance() and
> axis2_remove_instance() functions - initially I have added it to all
> functions in the sample code but these two :)
>
>
> Thank you,
>
> alex.
>
>
> On Thu, Mar 20, 2008 at 12:10 AM, Manjula Peiris <[EMAIL PROTECTED]> wrote:
>> Hi Alex,
>>
>> I think extern C alone should solve the problem. Because recently I did
>> the same thing and it worked for me. Can you try only with extern C
>> solution ?
>>
>> Thanks,
>> -Manjula.
>>
>>
>>
>>
>> On Wed, 2008-03-19 at 13:36 -0400, Alex Bolgarov wrote:
>> > OK, I used LD_PRELAOD env. variable to preload the libstdc++.so when
>> > starting the axis2_http_server, like this:
>> >
>> > LD_PRELOAD=/usr/lib/libstdc++.so.6 ./axis2_http_server -r
>> ${AXIS2C_HOME} -l 6 &
>> >
>> > and now my test runs successfully: the client sends a request, I see
>> > in the axis log tracing of function calls that I added to every
>> > function in my service, and then the client receives a response.
>> >
>> > I'm not sure that a solution with LD_PRELOAD is a good one, does any
>> > one have an opinion?
>> >
>> > Anyway, in production all this is going to run as a Apache httpd
>> > module, and we already know how to load libstdc++.so into the httpd,
>> > so I'm going now to build the mod_axis and try to run the test again,
>> > now with httpd :)
>> >
>> >
>> > > But, amazingly I never got, undefined symbol:
>> __gxx_personality_v0.
>> > >
>> > > Instead my server seg_faulted and crashed.
>> >
>> > Senaka, after I did something (I don't remember exactly what, I have
>> > done a lot of experimenting this morning) I also stopped getting
>> > undefined __gxx_personality_v0 and the server just started crashing
>> > (SIGSEGV); and when I run gdb on the core file, I also saw the that
>> > the crash was occurring in the AXIS2_SVC_SKELETON_INIT().
>> >
>> > But then, after some more experimenting, I added 'extern "C"' to the
>> > functions axis2_get_instance() and axis2_remove_instance() in my test
>> > service, and the test run successfully. Well, at least this is what I
>> > think fixed this crash :).
>> >
>> > So, two things so far: a) preload the libstdc++.so, and b) use
>> 'extern
>> > "C"' on the functions that the Axis calls directly (that is, loads by
>> > name?)
>> >
>> >
>> > Thank you,
>> >
>> > alex.
>> >
>> >
>> > On Wed, Mar 19, 2008 at 10:44 AM, Senaka Fernando <[EMAIL PROTECTED]>
>> wrote:
>> > > Hi Alex,
>> > >
>> > > I tried Axis2/C with a C++ client and it works fine. However, when
>> it
>> > > comes to server side, the message receiver can't invoke the
>> > > AXIS2_SVC_SKELETON_INIT(), probably because it was built in C
>> instead of
>> > > C++. Thus, I guess that you will have to rebuild axis2/C using g++
>> in the
>> > > first place.
>> > >
>> > > But, amazingly I never got, undefined symbol:
>> __gxx_personality_v0.
>> > >
>> > > Instead my server seg_faulted and crashed.
>> > >
>> > > Will work on this and let you know if I get through.
>> > >
>> > > Regards,
>> > > Senaka
>> > >
>> > >
>> > >
>> > > > I've tried with two versions: first, I downloaded and compiled
>> latest
>> > > > released Axisc/2 v. 1.3.0 from the http://ws.apache.org/axis2/c;
>> after
>> > > > seeing this error, I downloaded a "WSO2 Web Services Framework
>> for
>> > > > C++" from the http://wso2.org/projects/wsf/cpp, where, I hoped,
>> given
>> > > > that the name includes "for C++", the C++ problems would be
>> solved.
>> > > > This release, as I understand, includes Acis2/C version 1.2. The
>> same
>> > > > error (with the same text returned by dlerror(), after I added
>> > > > logging of this) happens in both cases.
>> > >
>> > > >
>> > > >
>> > > > Thank you,
>> > > >
>> > > > alex.
>> > > >
>> > > >
>> > > > On Tue, Mar 18, 2008 at 10:36 PM, Manjula Peiris
>> <[EMAIL PROTECTED]> wrote:
>> > > >> Hi Bolgarov,
>> > > >>
>> > > >> What is the Axis2/C version you are using?
>> > > >>
>> > > >>
>> > > >>
>> > > >>
>> > > >> On Tue, 2008-03-18 at 17:17 -0400, Alex Bolgarov wrote:
>> > > >> > Hi,
>> > > >> >
>> > > >> > I'm trying to write a SOAP service using Axis2/C framework.
>> I need
>> > > >> the
>> > > >> > service to be written in a C++ language, so as a first step
>> I took an
>> > > >> > 'echo service' example from the Axis distribution, renamed
>> it to .cpp
>> > > >> > file and compiled/linked it with 'g++' compiler. No compile
>> errors
>> > > >> > reported, the resulting .so library I copied to the services
>> > > >> > directory, together with the corresponding services.xml
>> file.
>> > > >> >
>> > > >> > I compiled a sample client that tries to send something to
>> my new
>> > > >> service.
>> > > >> >
>> > > >> > Than I strarted an 'axis2_http_server' application and run
>> the
>> > > >> client,
>> > > >> > which failed with a SOAP error message about failure to load
>> a dll.
>> > > >> >
>> > > >> > I found in the Axis2/C source code the place where it loads
>> the .so
>> > > >> > file (axutil_class_loader_load_lib() in file
>> 'class_loader.c'), and
>> > > >> > added debug log message that reports into the log the exact
>> text of
>> > > >> an
>> > > >> > error as it is returned by dlerror() function, not just a
>> message
>> > > >> that
>> > > >> > if failed to load a library, like this (after line 156 of
>> the file
>> > > >> > 'class_loader.c'):
>> > > >> >
>> > > >> > if (!dl_handler)
>> > > >> > {
>> > > >> > AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI,
>> > > >> > "AXIS2_PLATFORM_LOADLIB error:
>> [%s]",
>> > > >> > AXIS2_PLATFORM_LOADLIB_ERROR);
>> > > >> >
>> > > >> > ...
>> > > >> > ...
>> > > >> > ...
>> > > >> >
>> > > >> > after recompiling the Axis and running the test again, I see
>> in the
>> > > >> > log following message:
>> > > >> >
>> > > >> > class_loader.c(159) AXIS2_PLATFORM_LOADLIB error:
>> > > >> > [/home/alexb/wsfcpp-repo/services/my_service/libmy_service.so:
>> > > >> > undefined symbol: __gxx_personality_v0]
>> > > >> >
>> > > >> > I understand that the real problem is that the
>> axis2_http_server
>> > > >> > application is not compiled/linked with the g++ support
>> libraries.
>> > > >> > Several years ago I had similar problem when writing a C++
>> module for
>> > > >> > Apache's httpd server, but there the solution was to use an
>> httpd's
>> > > >> > directive 'LoadFile' to load the g++ runtime library into
>> the httpd
>> > > >> > environment before loading my C++ module with the LoadModule
>> > > >> > directive.
>> > > >> >
>> > > >> > So the question is, does anyone knows how to make the
>> > > >> > axis2_http_server to load the g++ runtime library before it
>> loads a
>> > > >> > C++ .so service library?
>> > > >> >
>> > > >> > For the record, I'm doing all this on the Ubuntu 7.10, and
>> here is a
>> > > >> > result of running 'g++ --version:
>> > > >> >
>> > > >> > $ g++ --version
>> > > >> > g++ (GCC) 4.1.3 20070929 (prerelease) (Ubuntu
>> 4.1.2-16ubuntu2)
>> > > >> >
>> > > >> >
>> ---------------------------------------------------------------------
>> > > >> > To unsubscribe, e-mail:
>> [EMAIL PROTECTED]
>> > > >> > For additional commands, e-mail:
>> [EMAIL PROTECTED]
>> > > >> >
>> > > >>
>> > > >>
>> > > >>
>> ---------------------------------------------------------------------
>> > > >> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> > > >> For additional commands, e-mail:
>> [EMAIL PROTECTED]
>> > > >>
>> > > >>
>> > > >
>> > > > ---------------------------------------------------------------------
>> > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
>> > > > For additional commands, e-mail: [EMAIL PROTECTED]
>> > > >
>> > > >
>> > >
>> > >
>> > > ---------------------------------------------------------------------
>> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
>> > > For additional commands, e-mail: [EMAIL PROTECTED]
>> > >
>> > >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: [EMAIL PROTECTED]
>> > For additional commands, e-mail: [EMAIL PROTECTED]
>> >
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]