| 1 |
# dldemo.icn -- dynamic loading demo |
| 2 |
# |
| 3 |
# Calls a simple C function that prints out its arguments. |
| 4 |
|
| 5 |
$include "libnames.icn" |
| 6 |
|
| 7 |
global argdump |
| 8 |
|
| 9 |
procedure main() |
| 10 |
argdump := loadfunc(FUNCLIB,"argdump") |
| 11 |
write("loadfunc result: ", image(argdump)) |
| 12 |
xcall(1, "a") |
| 13 |
xcall() |
| 14 |
xcall(&null) |
| 15 |
xcall(1, 2, 3) |
| 16 |
xcall("abc", "abcde"[2+:2], 123, 4.56, 'quick brown fox') |
| 17 |
xcall(&input, &output, &errout) |
| 18 |
xcall(main, argdump, [], &main, ) |
| 19 |
end |
| 20 |
|
| 21 |
procedure xcall(args[]) |
| 22 |
writes("\nargs:") |
| 23 |
every writes(" ", image(!args) | "\n") |
| 24 |
write("--- ", image(argdump ! args) | "failed") |
| 25 |
end |