Generated files .h and .c++

已查看 27 次
跳至第一个未读帖子

Nogueira

未读,
2021年5月4日 13:28:432021/5/4
收件人 Cap'n Proto
Hi,

I have been using capnproto to perform serialization and de-serialization using mmap. Works pretty well and it's fast! 
I noticed I'm able to compile and use code without the generated .c++ file, which seems to have some hardcoded tables in it.
What exactly is the c++ file used for? Am I encountering any problem if I use the header but not the c++ file? 

Thanks!

Kenton Varda

未读,
2021年5月5日 00:13:092021/5/5
收件人 Nogueira、Cap'n Proto
The tables are used to support the "schema" and "dynamic" APIs (aka "reflection"). These APIs are useful for a bunch of things, and in particular they are used to implement text stringification of messages (e.g. for debugging) and JSON conversion.

I think some code is also generated in the .c++ file for RPC interfaces.

If you don't get a linker error when you omit the .c++ file, then you must not be using these features. It's fine to omit the file if you don't see any errors from doing so. Note, though, that you might find you suddenly need the .c++ file in the future after some code change, or a future version of Cap'n Proto might start to require it. I'd generally recommend making it part of your build, but configuring your linker to drop unused objects, rather than intentionally omit it.

-Kenton

--
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 capnproto+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/capnproto/d522df33-da2e-4372-bcb6-a3e760b6871fn%40googlegroups.com.
回复全部
回复作者
转发
0 个新帖子