Comments (6)
Doesn't look like there's any metadata for that - not sure what that would be. I'll pass this question on to the win32metadata repo for discussion.
from wdkmetadata.
Related to microsoft/win32metadata#1044 where ClangSharp doesn't scrape DECLSPEC_ALIGN
.
@tannergooding any updates on this issue?
from wdkmetadata.
Haven't had a chance to dig into it yet.
This is also a particularly troublesome case since its not packing, but rather individual field adjustments which can't be represented by many languages/runtimes and a case where the layout will differ between 32-bit and 64-bit, so its not something that can necessarily be picked up with a single traversal.
-- Even with this metadata, I'm not sure Rust has an attribute to do this layout itself. It has repr(C)
and it has packed(x)
and align(x)
, but those are all for structs, not fields. I think at best it would need to have a nested transparent struct with its own align modifier (differing for 32-bit vs 64-bit).
from wdkmetadata.
-- If someone else wants to give it a go, contributions are welcome and the relevant attributes should be available off the AST nodes already.
from wdkmetadata.
Even with this metadata, I'm not sure Rust has an attribute to do this layout itself. It has repr(C) and it has packed(x) and align(x), but those are all for structs, not fields. I think at best it would need to have a nested transparent struct with its own align modifier (differing for 32-bit vs 64-bit).
I don't think there's any problem with that, so long as the metadata is there. A PointerAlignment<T>
struct makes sense. There are other places we do shenanigans to make things work (e.g. Rust doesn't have inline unions). An alternative would be manually adding padding which is a bit blah.
from wdkmetadata.
I don't think there's any problem with that, so long as the metadata is there
Sure, just it needs to be clarified where it is relevant for ABI purposes/etc.
T
and S<T>
(given struct S<T> { T value; }
) are different from the ABI perspective. This is why rust has the "transparent struct" attribute -- this is particularly relevant for COM/instance methods on Windows where struct returns are treated differently from primitive returns
Similarly, struct S { int32_t x; int64_t y; }
and struct S { int32_t x; int32_t padding; int64_t y; }
are different and may be handled differently by some platforms/ABIs/classifiers, so manually declaring padding is not "safe" -- many ABI classification systems ignore padding bits, but do not ignore explicitly declared fields. Thus this can change whether its classified as HFA/HVA or how many registers it can be split across.
An anonymous struct/union is likewise explicitly a different struct/union, just one where language syntax allows direct access and thus struct S { int32_t x; struct { int32_t x; int32_t y; }
is different from struct S { int32_t x; int32_t y; int32_t z; }
from the ABI/layout perspective -- this becomes particularly relevant in cases such as struct S { struct { int64_t x; int32_t y; } int32_t z; }
where the fact that it is a nested anonymous struct means the size is (8 + 4 + 4 padding) + (4 + 4 padding)
(and therefore size=24
, not size=16
). This also often impacts inheritance in C++ where the first field is explicitly Base
not the same fields
from Base
repeated inline.
There are even platforms where the signedness of the type is relevant for ABI purposes and thus int32_t
and uint32_t
are different, thus causing incorrect results if you declare your interop signature taking i32
where the actual signature took u32
or vice versa.
from wdkmetadata.
Related Issues (20)
- Add missing NDIS APIs HOT 1
- Missing WDF Device Functions in Metadata
- ntdll functions HOT 10
- KeBugCheckEx should be made to use the System.Diagnostics.Debug BUGCHECK_ERROR enumeration
- The API "LsaFreeReturnBuffer" is ambiguous. HOT 2
- Add FILE_INFORMATION_CLASS
- CM_POWER_DATA can use one more enum
- Missing DEVPKEY_s HOT 6
- Incorrect DRIVER_OBJECT member types HOT 1
- why define NTSTRSAFE_USE_SECURE_CRT as 0 here? HOT 1
- Missing `ThreadNameInformation`
- Inconsistent alignment of `CM_PARTIAL_RESOURCE_DESCRIPTOR` structure HOT 1
- `VHF_CONFIG` callbacks have wrong signature HOT 1
- Invalid "optioning" of driver callbacks. HOT 1
- There's no `NtOpenDirectoryObject` and `NtQueryDirectoryObject` HOT 3
- Nt vs Zw exports HOT 2
- Some more missing DEVPKEYs
- Add `RtlIsDosDeviceName_U` and `RtlDosPathNameToNtPathName_U_WithStatus`
- `OBJ_INHERIT` and related attributes are `int` whereas `OBJECT_ATTRIBUTES.Attributes` is `uint`
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 wdkmetadata.