Call a foreign-language function: Difference between revisions
Content added Content deleted
m (→{{header|Ol}}) |
|||
Line 1,818: | Line 1,818: | ||
(define self (load-dynamic-library #f)) |
(define self (load-dynamic-library #f)) |
||
(define strdup (self type-string "strdup" type-string)) |
(define strdup (self type-string "strdup" type-string)) |
||
(print (strdup "Hello World!")) |
|||
</lang> |
|||
Windows has no a "strdup" function, so windows version should look like this. |
|||
<lang scheme> |
|||
(import (otus ffi)) |
|||
(if (not (has? *features* 'Windows)) |
|||
(print "The host platform is not a Windows!")) |
|||
(define self (load-dynamic-library "shlwapi.dll")) |
|||
(define strdup (self type-string "StrDupA" type-string)) |
|||
(print (strdup "Hello World!")) |
(print (strdup "Hello World!")) |