src/Pure/General/sha1.ML
changeset 72554 81518b38b316
parent 72537 18eed4f718e0
child 72661 fca4d6abebda
equal deleted inserted replaced
72553:4e9d22dcd595 72554:81518b38b316
   146 (* C library and memory *)
   146 (* C library and memory *)
   147 
   147 
   148 val library_path =
   148 val library_path =
   149   Path.explode ("$ML_HOME/" ^ (if ML_System.platform_is_windows then "sha1.dll" else "libsha1.so"));
   149   Path.explode ("$ML_HOME/" ^ (if ML_System.platform_is_windows then "sha1.dll" else "libsha1.so"));
   150 
   150 
   151 fun library_call args =
   151 val library_call =
   152   Foreign.buildCall3
   152   Foreign.buildCall3
   153     (Foreign.getSymbol (Foreign.loadLibrary (File.platform_path library_path)) "sha1_buffer",
   153     (Foreign.getSymbol (Foreign.loadLibrary (File.platform_path library_path)) "sha1_buffer",
   154       (Foreign.cByteArray, Foreign.cUlong, Foreign.cPointer), Foreign.cPointer) args;
   154       (Foreign.cByteArray, Foreign.cUlong, Foreign.cPointer), Foreign.cPointer);
   155 
   155 
   156 fun with_memory n =
   156 fun with_memory n =
   157   Thread_Attributes.uninterruptible (fn restore_attributes => fn f =>
   157   Thread_Attributes.uninterruptible (fn restore_attributes => fn f =>
   158     let
   158     let
   159       val mem = Foreign.Memory.malloc (Word.fromInt n);
   159       val mem = Foreign.Memory.malloc (Word.fromInt n);