Programming Languages on Crack

IGotD- nise at nise.com
Thu Jun 17 09:56:01 UTC 2021


On Thursday, 17 June 2021 at 02:02:58 UTC, Walter Bright wrote:
>
>
> [...]

So let's say we keep it as it is with this @safe, @trusted, 
@system on function level. How is this going to work with FFI? 
With ImportC if you are going to be able to call C functions from 
safe code, then you need to designate the either @safe or 
@trusted. Now many C function actually want a pointer, like 
strings for example which might be potentially harmful (probably 
a cast required). Either you must create @trusted trampolines 
that works with D primitives or C functions can only be called 
from @system code.

In this particular case @system blocks could be useful if you 
don't want to create trampoline code for many C functions.

How @safe, @trusted, @system work with FFI is not documented here.

https://dlang.org/spec/memory-safe-d.html

and I think it needs to be defined.


More information about the Digitalmars-d mailing list