char[]/ubyte[] compile error

Jacob Carlborg via digitalmars-d-ldc digitalmars-d-ldc at
Thu Jul 13 02:51:00 PDT 2017

On 2017-07-12 23:14, Damien Gibson wrote:
> Hi all. As I'm sure you all know documentation is hit and miss for if it 
> exists or is good with DLang (And compilers) and this issue i'm not 
> totally sure if either or at this point.
> C++ cooperation with dlls made in dmd was pretty nonexistant from all my 
> previous attempts and LDC works fine.
> However in the case of what i'm currently making it requires the use of 
> a byte array (0-255) and i've tried either char[] or ubyte[] and on 
> either of them the compiler always returned this error:
> 'Error: Internal Compiler Error: unsupported type char[]'
> a direct method of reproducing this is:
> 1) Make a shared library(dll).
> 2) Generate in some code file - Module Name,
>                                  export:extern(C++):,
>                                  use above type as return or param;
> 3) Compile.
> I haven't had any luck finding documentation as to why this may be or 
> what it extends to if it isnt just arrays of those types nor do I have 
> any luck finding alternative methods to accomplish the same tasks those 
> 2 known types are required for.
> What I would like help for basicly is just to find out if maybe there is 
> limited usage in there and what alternative approach someone else may 
> have to the arrays. Thanks.

Perhaps you can declare a struct that contains a pointer and the length 
of the array. This is the internal representation of an array in D [1]. 
The struct would look like:

     size_t length;
     char* ptr;


/Jacob Carlborg

More information about the digitalmars-d-ldc mailing list