Daniel Brown | 18 Aug 2012 02:45
Picon

using an MSVC C DLL with Cygwin gcc

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)

Daniel Colascione | 18 Aug 2012 02:51

Re: using an MSVC C DLL with Cygwin gcc

On 8/17/2012 5:45 PM, Daniel Brown wrote:
>     for(i=0;i<10;i++)
>         printf("%d\n", b[i]);
                 ^^^^^^

You want %g or %f.


Gmane