RosettaCodeData/Task/Call-a-function-in-a-shared.../Lingo/call-a-function-in-a-shared...

19 lines
423 B
Plaintext

-- calculate CRC-32 checksum
str = "The quick brown fox jumps over the lazy dog"
-- is shared library (in Director called "Xtra", a DLL in windows, a sharedLib in
-- OS X) available?
if ilk(xtra("Crypto"))=#xtra then
-- use shared library
cx = xtra("Crypto").new()
crc = cx.cx_crc32_string(str)
else
-- otherwise use (slower) pure lingo solution
crcObj = script("CRC").new()
crc = crcObj.crc32(str)
end if