c++ and ws4d

137 views
Skip to first unread message

Luker

unread,
Apr 20, 2011, 6:01:26 AM4/20/11
to ws4d-gso...@googlegroups.com
Hello, I'm making some tests with ws4d-gsoap.

I have succesfully built a little C device and C client application.

I tried to give my client a UI with qt.
since a lot of code for the client was already present I copy-paste directly
from my old c client app.
all dpws headers seems to be c++ compatible, so i thougt it would have been easy...


after a (lot) of work, i managed to compile everithing (C server and C++ client)
with the same ws4d Cmakefile.

however to do so i had to include the usual qt stuff (no problem) and some other
things...
the cmake client part is as follows:

SET(train_client_SRCS
${qt_stuff}
/path_to_gsoap/gsoap-2.7.13/gsoap/stdsoap2.cpp
${GSOAP_STDSOAP2_SOURCE}
${gen_DIR}/inv1ServerLib.c
${gen_DIR}/train1ClientLib.c)

ADD_EXECUTABLE(train_client
${train_client_SRCS}
)
EXTEND_TGT_COMPILE_FLAGS(train_client
FLAGS "-DDPWS_CLIENT")

TARGET_LINK_LIBRARIES(train_client
${DPWS_LIBRARIES}
${DPWS-C_LIBRARIES}
${QT_LIBRARIES}
)

If i tried to let it use the standard C stdsoap2.c it would complain about not
finding the 'struct soap' constructor, so i used the .cpp one.
Now it complained about an undefined reference to 'namespaces' in stdsoap2.cpp
if you manually modify gsoap/stdsoap.h and add
#define WITH_NONAMESPACES
the error goes away.

Now it couldn't find a couple of debug functions, and i added
#define DEBUG in the same .h file...
everything works now (apart from a couple of warnings for redefining DEBUG and
WITH_NONAMESPACES

so...
I've done this, it kinda works, but i don't like what I've done ... it's a hack
and it isn't automated by Cmake...

Of course, i'm still building in DEBUG mode, so it may not be necessary/work for
other modes, but i'd like to test it this way before...

any suggestions to do it without manually modifying the .h file?

Luker

Elmar Zeeb

unread,
Apr 26, 2011, 6:19:15 AM4/26/11
to ws4d-gso...@googlegroups.com
Hi Luker,

C++ support in ws4d-gsoap is still a mess, as my C++ experience is close
to none :-)

At the moment i still suggest to use gsoaps c runtime (stdsoap2.c) and
remove the constructor from the header file but your solution looks also
very promising - it's maybe the better solution.

I fixed your issue with missing definitions in
http://trac.e-technik.uni-rostock.de/projects/ws4d-gsoap/changeset/423 .
You can use this cmake module in your project file and the missing
definitions should be defined.

Regards,
Elmar

If you can verify that this really works it would be great. Adding the
definitions in cmake is only a small problem and integrating the c++
runtime properly is also quite simple.

>
> Of course, i'm still building in DEBUG mode, so it may not be necessary/work for
> other modes, but i'd like to test it this way before...
>
> any suggestions to do it without manually modifying the .h file?
>
> Luker
>

--

*******************************************************************************
Dipl.-Inf. Elmar Zeeb
Universität Rostock, Fakultät f. Informatik und Elektrotechnik
Institut f. Angewandte Mikroelektronik und Datentechnik
University of Rostock, Faculty of CS and EE
Institute of Applied Microelectronics and Computer Engineering,
18051 Rostock
Deutschland/Germany
Tel. : ++49 (0)381 498 - 7262
Fax : ++49 (0)381 498 - 7252
Email: elmar...@uni-rostock.de
www : http://www.imd.uni-rostock.de/, http://www.ws4d.org/
*******************************************************************************

Luker

unread,
Apr 26, 2011, 9:05:42 AM4/26/11
to ws4d-gso...@googlegroups.com
Il 26/04/2011 12:19, Elmar Zeeb ha scritto:
> Hi Luker,
>
> C++ support in ws4d-gsoap is still a mess, as my C++ experience is close to
> none :-)
>
> At the moment i still suggest to use gsoaps c runtime (stdsoap2.c) and remove
> the constructor from the header file but your solution looks also very
> promising - it's maybe the better solution.
>
> I fixed your issue with missing definitions in
> http://trac.e-technik.uni-rostock.de/projects/ws4d-gsoap/changeset/423 .
> You can use this cmake module in your project file and the missing definitions
> should be defined.
>
> Regards,
> Elmar
Thanks for the change.

I'm trying to use the c version now, I managed to make it compile, and cleaned
things a bit:

basically all I had to do to suppress the constructor error and use stdsoap.c
without all the work I posted before was to initialize soap like this:

struct soap *client;
client = soap_new();

and it compiles without problems or warnings...
sorry i didn't write it before, i had a couple of segfaults that took a little
time to figure out...

anyway, everything seems to be working for now.

Luker

Reply all
Reply to author
Forward
0 new messages