Comments (9)
I propose closing this issue and maybe opening tracking issue listing all the other issues related to C++ features. What do you way?
from rust-bindgen.
Can bindgen handle SFINAE?
from rust-bindgen.
@fitzgen nope, for obvious reasons, sorry, forgot to mention it.
from rust-bindgen.
The template unions with template parameters thing should be doable once #61 lands.
from rust-bindgen.
I'm a bit surprised bindgen can't handle this:
$ cat test.h
template <typename T>
void foo(T a);
$ bindgen --version
bindgen 0.21.2
$ bindgen test.h -- -x c++
ERROR:bindgen::ir::item: Unhandled cursor kind CXCursorKind(30): Cursor(foo kind: FunctionTemplate, loc: test.h:2:6, usr: Some("c:@FT@>1#Tfoo#t0.0#v#"))
/* automatically generated by rust-bindgen */
Is this expected? It's not any fancy specialization, just a normal templated function.
from rust-bindgen.
We can't invoke the C++ compiler to generate new instantiations of templates, so I don't think we even try to keep track of them currently.
Perhaps we could track explicit instantiations of template functions (14.7.2 in the standard) and make bindings to those.
For example, if given
template<class T> void foo(T t) { /∗ ... ∗/ }
template void foo(char);
template void foo(int);
We could generate something like:
extern "C" {
#[link_name = "..."]
pub fn foo_char(char);
#[link_name = "..."]
pub fn foo_int(int);
}
But either way, we can't create new template instantiations since we aren't a C++ compiler and aren't creatign new object files from C++ code, so without those explicit instantiations to help us know what already exists, I don't think we can do much else.
from rust-bindgen.
Filed #492 for tracking explicit instantiations of template functions and generating bindings for them.
from rust-bindgen.
Just hit this while trying to work on #492.
Here's the output, in case anyone finds it helpful: https://gist.github.com/anonymous/d20daf345e3b7512061c719e15684bb9.
Note that it includes the Unhandled cursor kind 30: Cursor(__test kind: FunctionTemplate
bit tracked in #492, but also includes a bunch of Unhandled cursor kind 21: Cursor(__on_zero_shared kind: CXXMethod
.
EDIT: also featured is Unhandled cursor kind 24: Cursor(shared_ptr<_Tp> kind: CXXConstructor
.
from rust-bindgen.
superseded by #2343
from rust-bindgen.
Related Issues (20)
- Publishing self-contained static executable (with bundled libclang.a) HOT 1
- How to construct the std::string variable in the generated rust HOT 2
- Feature request: use DST to represent structures with flexible array members HOT 7
- BindgenUnion can get incorrect alignment on i686 HOT 1
- feature: wrap every C function on unsafe blocks HOT 8
- docummenting of usage dynamic_library_name
- `size_t` incorrectly used when stdlib.h is included for aarch64-unknown-none HOT 4
- Workaround for atomic types
- Private padding and alignment fields + missing Defaut/Clone/Copy implementations HOT 3
- Convert `pub type __u8 = ::std::os::raw::c_uchar;` to `u8` (native) Rust types HOT 6
- Deriving common traits (`Copy` / `Clone`) doesn't appear to be working for anonymous unions/structs HOT 1
- Feature request: compile-time layout tests
- RFE: API for renaming struct fields HOT 1
- `__IncompleteArrayField` does not `impl ::std::marker::Copy` HOT 2
- Enhancing VTable Generation to Support Inherited Classes HOT 1
- error: linking with `link.exe` failed: exit code: 1120 HOT 3
- `static mut` deprecation HOT 1
- Bindgen release
- Failed to generate `Default` impl for arrays larger than 32 entries HOT 8
- wrap-static-fns converts _Bool to bool, causing a compile error 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 rust-bindgen.