#1 2012-05-07 16:04:16

simon
Member
Registered: 2012-05-07
Posts: 11

Running a simple example

Hi,

I am trying to build the Dictionary snippet and run it outside of CppMicroServices' build as an exercice to make an external module.

I can run the executable built by CppMicroServices' build just fine -- and the Dictionary service is found.
Here's the normal output.

$ ./uServices-dictionaryservice 
get service ref DictionaryService/1.0 for module DictionaryServiceModule = 1 refs
Dictionary contains 'Tutorial': 1

Now, I have taken the snippet out and trying to make a very simple build out of it.
Here's my build script:

#!/bin/bash

US_ROOT=${HOME}/Workspace/ReflectionCpp/CppMicroServices
US_LIB=${US_ROOT}/lib/libCppMicroServices.so
US_INCLUDE=${US_ROOT}/include/
OPTS="-std=c++0x"


g++ ${OPTS} -I${US_INCLUDE} -c src/main.cpp -o main.o
g++ -L/usr/local/lib/ main.o -o testApp -lCppMicroServices

It builds just fine, but when running it the Dictionary service is *not* found:

$ LD_LIBRARY_PATH=/usr/local/lib/ ./testApp 
get service ref DictionaryService/1.0 for module DictionaryServiceModule = 0 refs

The Load(ModuleContext*) method of the Activator is not even called (I made sure by adding a log on stdout there).

What am I missing?

Cheers,
Simon

Offline

#2 2012-05-07 16:59:17

sascha
Administrator
Registered: 2012-05-04
Posts: 45

Re: Running a simple example

Offline

#3 2012-05-07 17:05:57

simon
Member
Registered: 2012-05-07
Posts: 11

Re: Running a simple example

I had it pinned down to the fact that the activator symbol wasn't found (registering the service immediately in main()) but I did not know about this linking option. It now works perfectly :-).

And yes, a project generator would likely have saved me here.

Thanks a lot!

Last edited by simon (2012-05-07 17:06:56)

Offline

Board footer

Powered by FluxBB