Since it's a constexpr, the compiler will evaluate it to an integer at compile-time, so it shouldn't pull in any symbols at all.
-Kenton On Wed, Apr 22, 2020 at 6:36 PM Vitali Lovich <[email protected]> wrote: > Sorry. I did mean `capnp::typeId<MyStructType>` rather than looking it up > dynamically for a type. Does capnp::typeId cause the entire schema to be > pulled in? It looks like it just pulls in EnumInfo<T>::typeId so I'm hoping > function/data sections will cause the encoded schema itself to be stripped > out. > > On Wed, Apr 22, 2020 at 3:55 PM Kenton Varda <[email protected]> > wrote: > >> Hi Vitali, >> >> Hmm, what do you mean by "at runtime"? Type IDs are not sent on the wire, >> so if all you have are some bytes, there's no way to get the type ID. >> >> If you know the type at compile time, you can use >> `capnp::typeId<MyStructType>()` in code to get the type ID of a struct as a >> constexpr... but that's compile time, not runtime. >> >> -Kenton >> >> On Wed, Apr 22, 2020 at 5:35 PM <[email protected]> wrote: >> >>> What's the proper way to get the ID associated with a struct at runtime? >>> Will accessing this pull in the entire dynamic schema? I'm hoping I can >>> just get the ID with minimal overhead. >>> >>> Thanks! >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Cap'n Proto" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/capnproto/ed804680-408b-45a4-acaf-a195c560deb1%40googlegroups.com >>> <https://groups.google.com/d/msgid/capnproto/ed804680-408b-45a4-acaf-a195c560deb1%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> >> -- You received this message because you are subscribed to the Google Groups "Cap'n Proto" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/capnproto/CAJouXQkj4dsU63UGMnRGKVORdxp82Efmeq%3D6iD2gH0vkewJuCQ%40mail.gmail.com.
