how to pass a ubyte[] to c interface?
Rikki Cattermole via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Mar 12 23:39:27 PDT 2015
On 13/03/2015 7:35 p.m., zhmt wrote:
> ubyte[] arr ;
>
> I pass the arr.ptr to c program, it fails silently.
>
> Is there any way to cast a ubyte[] to a clang pointer?
Theoretically this should work.
D:
void func(ubyte[] value) {
func(value.length, value.ptr);
}
extern(C) void func(size_t length, ubyte*);
C:
void func(size_t length, ubyte*) {
// ...
}
More information about the Digitalmars-d-learn
mailing list