sokol-d: Static Struct
Matheus Catarino
matheus-catarino at hotmail.com
Sat Dec 30 19:27:08 UTC 2023
Hi everyone. 👋
Currently I'm working on D binding for sokol project (truly a
dual bindgen [sokol-tools, sokol-header]) which could be merged
into the upstream project.
Up to now, my "ideal" configuration has been to run all the
ported examples (from other supported bindings) on Drt or betterC
provided @safe has DIP1000 enabled (not obligatory).
Except for the "clear" example (no have structs) works, the rest
of the examples have partial execution, without 2D/3D animations,
like the original ported examples.
e.g.:
https://github.com/kassane/sokol-d/blob/main/src/examples/sgl_context.d
Based on the articles in the official documentation, I tried to
use `__gshared` (no `@safe`) to attribute both the display and
offscreen structures inside state, but it didn't work.
```d
@disable struct State
{
@disable this();
@disable this(this);
__gshared Display display;
__gshared Offscreen offscreen;
}
static assert(!__traits(isDisabled, State));
static assert(!__traits(isCopyable, State));
```
## Reproduce
![sokol_d_sglcontext](https://github.com/kassane/sokol-d/assets/6756180/0e8391f6-056e-46db-b8e8-021309954ffe)
## Expected
![sokol_zig_sglcontext](https://github.com/kassane/sokol-d/assets/6756180/576176f8-005a-408d-9ae7-00948161b19f)
More information about the Digitalmars-d-learn
mailing list