Guest Fabian[...]
Die .dll heißt Carbondioxide.dll und die Funktion dazu DOTP mit den Argumenten Druck und Temperatur. Diese Argumente sind als Referenz zu übergeben; der Rückgabewert erfolgt direkt als value schreiben die Autoren der .dll.
[...]
Code (perl): (dl )$function=Win32::API->new('CARBONDIOXIDE','DOTP','DD','D');
[...]
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
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);
Guest FabianPoste du dort bitte einen Link hier hin auf den Thread ;)Frage: Soll ich / willst Du die Lösung in dem crossposting bekannt geben?