use 5.010; use strict; use warnings; use Win32::API; # Wrapper for external function with awkward interface sub DOTP { # Get arguments my ($T, $P) = @_; # Prepare foreign function interface, if necessary state $ffi = Win32::API->new( 'CARBONDIOXIDE', 'double DOTP(LPDOUBLE lpT, LPDOUBLE lpP)' ); # Pack arguments into memory to be passed to the function my $bufT = pack('d', $T); my $bufP = pack('d', $P); # Perform external call and return value return $ffi->Call($bufT, $bufP); } # Test the thing say DOTP(300, 6);