I posted this question on stackoverflow, archival redirection link:

https://stackoverflow.com/questions/72733063/v8-lib-and-c-inlining-behavior-differs-from-expectations-and-reproducing-in-se

On Tuesday, June 21, 2022 at 11:23:34 AM UTC-5 Adam Bennett wrote:

> I'm getting an error trying to construct a ScriptOrigin object. Confirming 
> the compiler error, my IDE only resolves the implicit copy and move 
> constructors.
>
> v8_api.cc: error: no matching constructor for initialization of 
> 'v8::ScriptOrigin'
>
> I'm building my project with CMake and Apple clang version 13.1.6 and 
> using an embedded v8 with args.gn:
>
> v8_static_library=true
> v8_monolithic=true
> v8_use_external_startup_data=false
> is_component_build=false
> use_custom_libcxx=false
>
> If I change v8config.h to define V8_INLINE as an empty string, I still 
> can't resolve v8::ScriptOrigin::ScriptOrigin(...).
>
> When I run nm I get:
>
> libv8_monolith.a:v8-inspector-impl.o: 0000000000001070 0000000000000000 T 
> v8::ScriptOrigin::ScriptOrigin(v8::Isolate*, v8::Local<v8::Value>, int, 
> int, bool, int, v8::Local<v8::Value>, bool, bool, bool, v8::Local<v8::Data>)
> libv8_monolith.a:v8-inspector-impl.o: 00000000000070a0 0000000000000000 T 
> v8::ScriptOrigin::ScriptOrigin(v8::Isolate*, v8::Local<v8::Value>, int, 
> int, bool, int, v8::Local<v8::Value>, bool, bool, bool, v8::Local<v8::Data>)
>
> It looks like it's exporting a symbol twice for each object that uses it.
>
> I get the same nm result when I build libv8_monolith.a with args.gn 
> `v8_no_inline=true`, or without it or if I replace the #define V8_INLINE 
> blocks with `#define V8_INLINE inline` or `#define V8_INLINE /*not 
> inlining*/` or delete V8_INLINE from ScriptOrigin.
>
> I'm stumped. Why is it being exported as a symbol whether I build with 
> `v8_no_inline` or not and why is it being exported twice for each comp unit 
> that uses it?
>
> I should be able to modify the v8-message.h header file to not be inline 
> and then I could resolve the constructor from my codebase. However, I'm 
> guessing it wouldn't link against it because there's duplicate symbols in 
> the lib.
>
> Because I've never used inline I created a sandbox project and (consistent 
> with the docs I've read) confirmed that inlining prevents an external 
> symbol and linking from another object. My sample project does not show 
> symbols for always_inlined fns yet I see them in libv8_monolith.a.
>
> How does this API work within the v8 codebase, or from other embedders 
> like node.js or sample v8 code I've seen demoing module resolution (and 
> using ScriptOrigin)?
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/v8-users/e866a675-0f6c-4ee8-8eb3-f550aa374265n%40googlegroups.com.

Reply via email to