in reply to Calling win32:api dll with pointer to array

Well, you were close with both of your attempts. Change one comma to a period in your first try and you have something that should work:     $arr= pack("d",1) . pack("d",1.5) . pack("d",3); which can more compactly be written as your second try with @ changed to $:     $arr= pack("d3",1,1.5,3); or, to be more flexible:

my @arr= ( 1, 1.5, 3 ); my $arr= pack "d*", @arr; my $res= $obj->Call( $arr, 0+@arr );

An array of doubles in C is simply a bunch of doubles packed right next to each other in a contiguous span of memory. In Perl, the way to get a contiguous span of memory is in a string, so that is what pack produces.

        - tye (but my friends call me "Tye")

Replies are listed 'Best First'.
Re: (tye)Re: Calling win32:api dll with pointer to array
by dhorne (Initiate) on Jan 15, 2002 at 14:00 UTC
    Thanks guys

    it works now