Linux GNU libc++

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

Linux GNU libc++

Postby JulienIsorce » Tue Nov 24, 2020 7:46 am

Hi,

I should be able to link my application with GNU libc++ or in fact with any libc++ implementation right ?

Indeed I understand that libcef.so is created by using static libs from chromium (base, content, etc..) and using the static libc++.a from "chromium/src/buildtools/third_party/libc++" (if use_custom_libcxx is set true which is the case by default on Linux example Ubuntu 20.04) and using the dynamic shared library libc.so (libc.so and not the static libc.a mostly because of licence issues).
And the intention is that libcef.so only exposes the C API from CEF, this way there is no c++ implementation mixing with the application.
So far so good (except why all the internal CEF C++ api is exported in libcef.so, I can see that with "nm libcef.so", I was expecting to see only "cef_" C functions but I can see all C++ internal functions)

Then there is the CEF wrapper API and lib which is built to create: libcef_dll_wrapper.a
This wrapper module is only using the CEF C api functions, and the C++ functions that are defined in this wrapper module , i.e. it does not build or use any C++ function from chromium or cef, defined outside of the directory chromium/src/cef/libcef_dll/wrapper.
This way when an application use the CEF C++ api, it does not matter which libc++ implementation the application is linking with.
I.e. if an application create an std::string and pass it to the CEF C++ API and then if this string is destroyed by the cef wrapper module then everything should be ok.

But I noticed that the wrapper module is using CEF C++ from outside the wrapper module itself, example CefString.
So it is possible that the underlying c++ std::string of CefString created in libcef.so (so by chromium's libc++ implementation) is then destroyed in the libc++ that the application links with, leading to undefined behaviours and likely crashes.

Any comments on all of these would be very appreciated, I am trying to understand CEF a bit more :)

Thanks!
JulienIsorce
Newbie
 
Posts: 3
Joined: Tue Nov 24, 2020 6:50 am

Re: Linux GNU libc++

Postby magreenblatt » Tue Nov 24, 2020 2:14 pm

except why all the internal CEF C++ api is exported in libcef.so, I can see that with "nm libcef.so", I was expecting to see only "cef_" C functions but I can see all C++ internal functions

Use "nm -g libcef.so" to show only externally visible symbols. None of the C++ symbols should be listed.

But I noticed that the wrapper module is using CEF C++ from outside the wrapper module itself, example CefString.

How did you determine this?
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: Linux GNU libc++

Postby JulienIsorce » Tue Nov 24, 2020 4:38 pm

Thanks for the tips, indeed with -g (i.e. --extern-only) I only see cef_* C function so make sense now.
Upon your question I looked into CefString implementation and I could see that the implementation is in headers only. So all good about CefString it seems.
Then I could not find by hand a counter case.

I guess a case that would break is if in cef/libcef_dll/wrapper there is a file that uses an object A defined in a .cc outside of cef/libcef_dll.
And where this object A creates an STL object (ex: std::string) and where this STL object is destroyed in cef/libcef_dll .
Is there a script or an automated technic that verifies that this above case does not happen ? Was there any bug around that in the past ?

Thanks!
JulienIsorce
Newbie
 
Posts: 3
Joined: Tue Nov 24, 2020 6:50 am


Return to Support Forum

Who is online

Users browsing this forum: Google [Bot] and 45 guests