C
Christian Schmidt
Hi all,
I need to implement an unmanaged function that gets a SafeArray and
hands it over to a managed function having the managed array-type.
Using MarshalAs I can call unmanaged functions having SafeArray from
managed code. But here I need this vice-versa...
I assume it is doable with MarshalAs magic, but how?
Thanks
Christian
example:
ref class Funcs {
static double mysum(array<double>^ arr) {
double sum = 0;
for each(double x in arr) sum += x;
return sum;
}
};
extern "C" {
double WINAPI mysum(SAFEARRAY** arr) {
// ERROR - need some MarshalAs magic
return Funcs::mysum(arr);
}
}
I need to implement an unmanaged function that gets a SafeArray and
hands it over to a managed function having the managed array-type.
Using MarshalAs I can call unmanaged functions having SafeArray from
managed code. But here I need this vice-versa...
I assume it is doable with MarshalAs magic, but how?
Thanks
Christian
example:
ref class Funcs {
static double mysum(array<double>^ arr) {
double sum = 0;
for each(double x in arr) sum += x;
return sum;
}
};
extern "C" {
double WINAPI mysum(SAFEARRAY** arr) {
// ERROR - need some MarshalAs magic
return Funcs::mysum(arr);
}
}