Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide amalgamated source for the C shared library #713

Open
ddiproietto opened this issue Feb 20, 2024 · 1 comment
Open

Provide amalgamated source for the C shared library #713

ddiproietto opened this issue Feb 20, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@ddiproietto
Copy link
Collaborator

Similar to how we provide an amalgamated source for the C++ library, we should provide an amalgamated source for the C shared library.

@ddiproietto ddiproietto added the enhancement New feature or request label Feb 20, 2024
@ddiproietto ddiproietto self-assigned this Feb 20, 2024
@MarijnS95
Copy link

On the fly compiling and statically linking the C bindings is exactly what I need to bind Perfetto to Rust. That'll be much more convenient than pre-compiling and bundling libperfetto_c.so for various targets/architectures.

As a temporary workaround, would it be possible to compile perfetto_c statically, so that I don't have to move around and ship .so/.dlls?

Going forward, I see a few things in the C bindings that still need to change to make them fully usable for this use-case (Rust, without #includeing the the headers in a C project). Some of these points should likely be split out into separate issues:

  • Improved documentation and samples for the raw C bindings. My Rust bindings are based on dissecting the implementations of various macros and static inline functions used in examples/shared_lib/ files;
  • Said static inline functions need to become exported functions, otherwise they need to be reimplemented in Rust based on (hopefully!) exported functions that are called inside;
    • One example is PerfettoTeCounterTrackRegister(), which I think is required to make counters work, i.e. they cannot be reported on the current process/thread track?;
    • Other examples are various static inline functions that end up calling lower-level *Impl() functions;
  • Will this become a second, separate amalgamated source file? The current perfetto.cc file takes very long to compile, and probably includes far too many sources that won't be needed for the C bindings;
  • Good documentation of when (pointers to) data outlive a function call. This seems to be the case specifically when registering categories but (obviously) not when emitting trace markers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants