Comments (6)
See here for info on representation.
from rusty-cheddar.
The docs suggest using an empty enum for opaque structs, but these can't be #[repr(C)]
.
What about unit structs?
from rusty-cheddar.
Even the enum would be easy enough to support, just check the variants are empty before checking for #[repr(C)]
and special case that.
from rusty-cheddar.
Thinking about it, you can't use empty enums for opaque structs because they need to be not opaque on the Rust side.
Instead I think private #[repr(C)]
structs should be opaque structs.
from rusty-cheddar.
The two current thoughts for opaque structs are
struct NonOpaque {
b: f64,
}
// typedef struct Opaque Opaque;
#[repr(C)]
pub struct Opaque(NonOpaque);
À la this playground. So any public #[repr(C)]
newtype would be an opaque struct that would have to be handled via pointers in C.
Alternatively have any public #[repr(C)]
struct with only private members be an opaque struct, this feels too magic to me though.
from rusty-cheddar.
Closed by b6a7cc1
from rusty-cheddar.
Related Issues (20)
- C++ headers support HOT 1
- An opaque struct should be a struct with all private members.
- Support diverging functions. HOT 1
- Use a ParseSess instead of a vector of errors.
- Header ifdef guard should filter out illegal characters HOT 2
- Dealing with NULL-able function pointers HOT 4
- const pointers are handled incorrectly.
- Support other representations.
- examples/pointer.rs contains invalid Rust code HOT 1
- Push 0.3.2 HOT 3
- Functions with no parameters should be declared `func(void)`
- `fn func(mut thing: T)` gets turned into `void func(T mut thing)`
- Update rusty-cheddar on crates.io HOT 2
- Provide more control over type names in generated headers HOT 1
- Types & functions generated by a macro aren't converted HOT 2
- Parser error with question mark operator HOT 1
- Type conversions are syntactic
- arrays should be supported
- Include license notice in generated headers HOT 1
- macOS Could not compile syntex_syntax v0.24.0 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rusty-cheddar.