Interfacing C programs: Pass D string to C function

Dfr deflexor at yandex.ru
Fri Dec 13 00:00:20 PST 2013


Hello

I trying to write simple wrapper around pcre and have problem 
passing strings to it. As i understood, the best way is  
std.string.toStringZ.

So, my code look like:

string pattern = "....";
pcre_compile2( toStringz(pattern), options, &errcode, &errmsg, 
&erroffset, cast(char*)null);

This gives me error:

Error: function pcre_compile2 (char*, int, int*, char**, int*, 
char*) is not callable using argument types (immutable(char)*, 
int, int*, char**, int*, char*)

Any ideas for better way to do this task ?


More information about the Digitalmars-d-learn mailing list