How to define align
for Packed
based on Platform
#48996
Labels
area-vm
Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends.
library-ffi
I have create a library for steam api. In steam, the alignment of structs changes from platform to platform. i.e. certain structs are aligned by 4 in linux and mac but 8 in windows.
I could not find a way to this in dart without writing two independent code per different configuration.
Here is an example:
The constant
align
should be able to change depending on the platform.Now, I afaik, compiler directives are not implemented in dart so there is no way to do this in compile time.
There again afaik, the only way to do this is eliminate
const
from the constructor of thePacked
.If there is any workaround other that writing duplicate package per platform please let me know.
The steam api repo is here if you want to investigate further: https://github.com/aeb-dev/steamworks
The text was updated successfully, but these errors were encountered: