Comments (6)
from x11-rs.
So to recap:
- One module per shared library, with corresponding functions => x11::{xlib,xi,xfixes,xinerama}...
- Constants and types in modules based on the header files they come from. Perhaps x11types::xlib::{...} . Or perhaps there should just be one module with all the relevant structs/constants, since the structs already have prefixes that namespace them - eg. 'x11types::{XIDeviceInfo, Success, Display ...}'
- One crate for statically linked X11, one for dynamically linked and one for constants/types shared between the two?
from x11-rs.
I guess the structure would depend on whether the bindings are generated at compile time or ahead of time. But glob re-exports into the root module would make the layout less important. If things are generated at compile time, I wouldn't see any benefit to splitting them up by header or library.
My first thought was to have types, constants and static functions all in the x11 module and dylib functions in the x11-dl module. But if libraries are feature gated in x11-dl to vastly improve compile time, then it may be worth it to merge them all into the same crate. This would require a macro similar to x11_link
for each individual library, which isn't such a bad thing.
from x11-rs.
For generating constant definitions, someone else had a much better idea - generate C++ code which leverages the compiler's type inference to determine the type of macros: http://vojtech.kral.hk/en/rust-importing-c-constants-proof-of-concept/
from x11-rs.
One of the problems I was thinking of when generating bindings from the C headers is determining the types of the thousands of macros. I've been thinking recently that they can all be c_int
unless they have an L
suffix, in which case they can be c_long
. It may be a little less ergonomic in many cases where the constant is meant for a type other than int
, but it still seems like a cleaner solution than writing constants by hand like we have been doing.
from x11-rs.
Closing in favor of #40.
from x11-rs.
Related Issues (20)
- x11 vs x11-dl? HOT 3
- undefined reference to `XOpenDisplay' HOT 1
- Debug implementation for XEvent is unsound
- XCreateIC returns null incorrectly but only if another crate (tempfile) is present HOT 1
- XshmSegmentInfo can't be created and its fields should be public
- unify x11/x11-dl crates with dlib HOT 2
- Can't run test_x11 test of my lib-crate even with xlib feature enabled HOT 6
- X11 build dependency failed. HOT 3
- Xcomposite extension HOT 1
- Xdamage extension HOT 1
- How to use the Xfixes extension? HOT 7
- MacOS Support HOT 3
- Can't load shared library on NetBSD
- Missing constant `None`? HOT 3
- Xlib::open takes up a significant amount of the binary HOT 5
- What is the difference between x11 and x11-dl? HOT 2
- Add documentation for the differences between x11 and x11-dl HOT 1
- x11-dl linker error when building musl target on Ubuntu 20.04 with rust 1.72+
- Does x11 support cross-compiling?
- libxext is not linked
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 x11-rs.