|
From: Chris F. <cd...@fo...> - 2011-12-09 17:56:06
|
On Fri, Dec 09, 2011 at 10:30:43AM +0100, deloptes wrote:
> OK, so here is something interesting to start with.
> I've got the framework to compile and link. Also the basic opensync related
> stuff. At this point I am not calling any synthesis functions as it needs
> to be configured first ...
I'm curious how it functions with the synthesis calls in there. :-)
> = osynctool --discover synth1 =
> EKO: get_sync_info:
> EKO: get_sync_info:
> EKO: get_sync_info:
I think these are from osynctool's group and format initialization.
> EKO: synthml_http_client_initialize
> EKO: httpClientSink->initialize() DONE
> EKO: connect to Synthesis
> EKO: OSyncObjTypeSink#contact
> EKO: initializing: contact
> EKO: synthml_discover: 1
> EKO: DevInf or similar asking the engine to provide information
> EKO: foreach collection
> EKO: configure ressource
> EKO: synthml_http_client_finalize:
> EKO: disconnect from Synthesis
> EKO: synthml_http_client_finalize: DONE
> Discovered Objtypes:
> contact
> Format: vcard21
> Format: vcard30
> EKO: get_sync_info:
> EKO: get_sync_info:
> Discovered Objtypes:
> contact
> Format: file
Not sure about these, but discovery is in a loop in osynctool...
> And something C/C++ related - where can I read about it, or can you answer
> briefly here. there is this extern C {} block and inside I can use
> std::cout << ...;
> How is this all handled by the compiler and/or processor so that it works
> from C. I would say it is the compiler that is doing the magic ... but I'm
> too curious to know what actually happens. In the book it says briefly, it
> is providing access to C++ functions from C.
You can use any C++ code, even in C++ functions called from C. What you
do _not_ want to have happen is for C++ exceptions to escape back into
C land.
So... in your C++ code:
extern "C" {
void cppfoo();
}
void cppfoo()
{
try {
cout << "Hello world!" << endl;
SomeClass obj;
obj.ThisThrows();
}
catch(...) {
cout << "Exception in C++ code!" << endl;
}
}
And in your C code, which is blissfully unaware of exceptions:
cppfoo();
If you need examples of this, check out the Barry opensync plugins.
- Chris
|