Communication between D and C with dynamic arrays

seany via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Aug 10 12:14:24 PDT 2014


So here is the final situtaion

I have a file: software_pluginInterface.di

Here I declare :

extern (C): void performComputation(char lib[], char func[], 
void* ptr[], int varNum );
// lib and func will be used later

Then i have the corresponding C file: software_pluginInterface.c, 
where I declare :

#include "stdio.h"
#include "string.h"

void performComputation(char lib[], char func[], void * v[], int 
varNum)
{

   printf("there are %d variables \n", varNum);

}



then I call this with :

performComputation(A, B, V, to!int(v.count()/3));

A, B are '\0' terminated char arrarys
V is a void pointer array with 6 elements


So I would expect a output like :
there are 2 variables

But I am getting : there are 1557197040 variables

Please help.


More information about the Digitalmars-d-learn mailing list