Hello,
I'm trying to dynamically load libplatform in an application I'm writing. I searched through the available gn options, but I couldn't find an option to build libplatform as a shared object, so I did it by hand:
$ gcc -shared -o libv8_libplatform.so obj/v8_lib{platform,base}/*.o
I use this both in debug and in release mode, but when I link my application against libplatform in release mode, I get "undefined reference to `v8::platform::CreateDefaultPlatform(int)`". This doesn't happen in debug mode. After some investigation, I realized that the aforementioned function is exported in debug mode, but is hidden in release mode:
# Debug
$ nm -C libv8_libplatform.so | grep CreateDefaultPlatform
000000000001ad70 T v8::platform::CreateDefaultPlatform(int)
# Release
$ nm -C libv8_libplatform.so | grep CreateDefaultPlatform
0000000000003b20 t v8::platform::CreateDefaultPlatform(int)
I inspected the ninja files, and realized this happens because object files are compiled with -fvisibility=default in debug mode, and with -fvisibility=hidden in release mode.
So, my question is: is this function not supposed to be used in release applications? Should I, then, link statically against the many individual .o files needed (as the hello-world.cc example does)? If so, what's the best way to do this?
Thanks in advance,
Andre