equal
deleted
inserted
replaced
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 val library_call = |
151 fun build_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); |
154 (Foreign.cByteArray, Foreign.cUlong, Foreign.cPointer), Foreign.cPointer); |
|
155 |
|
156 val library_call = |
|
157 if ML_System.platform_is_arm then fn args => build_call () args else build_call (); |
155 |
158 |
156 fun with_memory n = |
159 fun with_memory n = |
157 Thread_Attributes.uninterruptible (fn restore_attributes => fn f => |
160 Thread_Attributes.uninterruptible (fn restore_attributes => fn f => |
158 let |
161 let |
159 val mem = Foreign.Memory.malloc (Word.fromInt n); |
162 val mem = Foreign.Memory.malloc (Word.fromInt n); |