You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I propose that Tool provide a way like to_command to invoke a C preprocessor.
I am not sure whether this is feasible.
Use case
GNU lightning is a portable C library for JIT compilation. It is wrapped by the lightning-sys crate. Most all of GNU lightning's API is provided by function-like macros. Some of the macros' definitions and/or existence depend on the target-architecture-specific #if branches (the API is slightly different on 64-bit architectures from on 32-bit architectures).
During build.rs in lightning-sys I want to find function-like macros like these :
so that the build step can generate Rust macros like these :
jit_entry!( jit_addi_d(u,v,w) => add => [ i, d ] => jit_new_node_wwd(jit_code_addi_d,u,v,w))jit_entry!( jit_beqi_d(v,w) => beq => [ i, d ] => jit_new_node_pwd(jit_code_beqi_d,NULL,v,w))
which can then generate Rust entry points in a less manual and error-prone way than is currently used. I can already generate these Rust macros from a manually-preprocessed C header file, but I need some portable mechanism for determining which macros to generate and with what expansions. If cc provided access to a preprocessor, I would have a solution.
I recognize that this request does not fit into the stated purpose of the crate :
The purpose of this crate is to provide the utility functions necessary to compile C code into a static archive which is then linked into a Rust crate.
so if this is out of scope for this crate, then I understand.
The text was updated successfully, but these errors were encountered:
Proposal
I propose that
Tool
provide a way liketo_command
to invoke a C preprocessor.I am not sure whether this is feasible.
Use case
GNU lightning is a portable C library for JIT compilation. It is wrapped by the
lightning-sys
crate. Most all of GNU lightning's API is provided by function-like macros. Some of the macros' definitions and/or existence depend on the target-architecture-specific#if
branches (the API is slightly different on 64-bit architectures from on 32-bit architectures).During
build.rs
inlightning-sys
I want to find function-like macros like these :so that the build step can generate Rust macros like these :
which can then generate Rust entry points in a less manual and error-prone way than is currently used. I can already generate these Rust macros from a manually-preprocessed C header file, but I need some portable mechanism for determining which macros to generate and with what expansions. If
cc
provided access to a preprocessor, I would have a solution.I recognize that this request does not fit into the stated purpose of the crate :
so if this is out of scope for this crate, then I understand.
The text was updated successfully, but these errors were encountered: