Comments (6)
You probably should remove the note in the README saying this crate is in heavy development, the last commit to this repo was 8 months ago
from com-rs.
@rylev has any progress been made towards answering this question?
from com-rs.
Progress has been made, but a resolution has not been come to. We are certainly still looking to improve this crate in the short term, but the relationship with the windows crate is still not very clear.
from com-rs.
Thanks @rylev! I'll wait for that then before making a move, but would it help to detail my (arguably niche) use-case?
from com-rs.
Absolutely!
from com-rs.
@rylev Thanks! Besides using windows-rs
to call into Windows APIs in a nice way, we have this niche use-case of DXC that natively compiles to Linux and Windows as library and exposes COM objects through a DxcCreateInstance(class_id, r_iid, ppv)
. We are currently using the ancient com_rs
crate to describe the COM interfaces by hand and call into them, but the resulting API is as raw as C++ and this crate requires libuuid
.
We hence started looking into and have a working port with com-rs
back in the day, but this stagnated right as windows-rs
got announced which seems to be superior to com_rs
and com-rs
in almost every way:
- Newer, and supposedly integrating with or superseding
com-rs
(but that seems to be backtracked on now); - Bindings are fully autogenerated: DXC headers are already processed in win32metadata;
- Bindings are much more pretty: pointer-returns are wrapped in
Result
,riid
+ppv
pairs are "hidden" behind a template argument, array pointer+count are rewritten to accept slices, refcounting is handled onDrop
, et cetera;
This actually works for us (implementation is a little dated tohugh), but with one major caveat: windows-rs doesn't support Linux without some modifications. Most notably:
- Error handling calls into
unimplemented!()
Windows functions (cannot be linked on Linux) such asSetLastError
andGetErrorInfo
; - String handling is provided by
windows-rs
(which is nice!) but is only written for 16-bit wide-chars. Linux used 32-bit wchars. I've written some patches to utilizewidestring
(see the linked DXC proof of concept) but that obviously didn't get accepted, though I am open to write a native implementation.
All in all I don't see any reason for us to use com-rs
, given that we can get 32-bit WCHAR support behind a #[cfg(not(windows))]
and some shims (bare-bones default implementations) for those few functions that may be called when errors are handled. We're probably only interested in a pretty string for some well-known values (E_NOINTERFACE
) when formatting/unwrapping results.
from com-rs.
Related Issues (20)
- Parameters of class implementation should be borrowed, not owned
- Rust Analyzer can't recognize the IUnknown HOT 7
- Compatibility with Windows SDK / winapi crate HOT 1
- AbiTransferable on complex structures in winapi crate HOT 5
- Drop of COM class not working in webview2 example?
- Interfaces nested more than 2 levels deep do not compile HOT 1
- Does class! support generic types? HOT 1
- docs.rs failed to build com-0.4.0 HOT 1
- Request to add an "Accessible" example
- Question: How do I get interface vptr from a struct? HOT 2
- com::interfaces! is not clean of clippy warnings HOT 1
- New release? HOT 2
- Generate rust code from IDL/TLB/COM dll? HOT 14
- How to use com-rs? HOT 1
- Could not find `class` in `com` HOT 3
- Support local (not/temporarily heap allocated) class instances
- Incompatible with Windows-rs HOT 4
- This repo is missing important files
- any way to use activex dll?
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 com-rs.