Although I wanted to finish the 64-bit assembler for kForth-64 (a 64-bit version of asm-x86.4th) prior to implementing the ability to set up a
library interface for mapping and calling C functions in external shared object libraries to Forth words, my priority now is to go ahead and get
a library interface working for kForth-64 (the 64-bit assembler is still
in progress, though).
A primitive external library interface is now available for kForth-64
(using machine code). It is not yet full-featured enough to accomodate a
wide range of function argument cases, but the interface illustrates the mechanics of calling external C library functions. Two complications
make the 64-bit interface a bit more complicated to implement, over the simpler, but more advanced library interface found in kForth-32:
1. Function arguments are located in registers, rather than on the CPU
stack for the amd-64 calling convention.
2. The 64-bit version of kForth provides a separate fp stack, in line
with the Forth 200x standard.
An example of the use of the library interface for calling a portion of
the GNU GMP multiprecision library may be found at the link below.
https://github.com/mynenik/kForth-64/tree/master/forth-src/libs/gmp
Fair Warning: the library interface is in a state of development and may change so that call methods in future versions may not be backwards compatible with the (incomplete) existing call methods.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 300 |
Nodes: | 16 (3 / 13) |
Uptime: | 43:11:13 |
Calls: | 6,709 |
Calls today: | 2 |
Files: | 12,243 |
Messages: | 5,354,017 |