Global allocator of software compiled with `cc`

Hi Folks,

I got an interesting problem that you guys could help me with.

My software use SQLite and I use bindgen to build the binding at run time and the cc create to compile SQLite into an archive library that is then linked by rustc.

Now I want to change the global allocator doing something like it is show here: GlobalAlloc in std::alloc - Rust

It seems to work up to a point, all the rust code is indeed working with the new allocator, unfortunately, SQLite is still using its own allocator.

I know this by tracing malloc call with GDB.

It actually makes sense, the cc crate compile SQLite before that cargo even know that I am changing the allocator.

Is there a way to force the use of the global allocator also in SQLite?

(Yes, I know that I can manually change the memory allocator of SQLite, but I would rather not.)

No, sqlite doesn't care about GlobalAlloc at all. It uses plain'ol malloc family, as every C libraries do.