Files
l2/c_extern.sl

23 lines
501 B
Plaintext
Raw Normal View History

import stdlib.sl
import float.sl
2025-12-20 22:34:27 +01:00
# C-style externs (auto ABI handling)
extern long labs(long n)
extern void exit(int status)
extern double atan2(double y, double x)
2025-12-20 22:34:27 +01:00
word main
2025-12-20 22:34:27 +01:00
# Test C-style extern with implicit ABI handling
-10 labs puti cr
# Basic math
1.5 2.5 f+ fputln # Outputs: 4.000000
2025-12-20 22:34:27 +01:00
# External math library (libm)
10.0 10.0 atan2 # Result is pi/4
4.0 f* fputln # Outputs: 3.141593 (approx pi)
2025-12-20 22:34:27 +01:00
# Test extern void
0 exit
end