18 Aug 2012 02:45
using an MSVC C DLL with Cygwin gcc
Daniel Brown <danielbrown87 <at> gmail.com>
2012-08-18 00:45:14 GMT
2012-08-18 00:45:14 GMT
Hi all,
So I have a C dll written in MSVC which is being called by a Cygwin
programmed compiled with gcc. So far it all works ok apart from when I
try and pass an array that the dll should then change. For example I
have this in the dll:
__declspec(dllexport) void array_read_write(double *src, double *dest,
size_t length){
int i;
for(i=0; i<length; i++){
dest[i] = src[i];
}
}
When I call this from my Cygwin program I pass the src array as
1,2,3...10 and then print the output.
int main(){
int i;
double a[10],b[10];
for(i=0;i<10;i++)
a[i] = i+1;
array_read_write(a, b, 10);
for(i=0;i<10;i++)
printf("%d\n", b[i]);
(Continue reading)
RSS Feed