14.1.5 Foreign Language APIs

14.1.5.1 Foreign Language Interface

The conversion specifier (in foreign/[2,3] facts) string(N) has been dropped.

The conversion specifier chars has been renamed to codes, in analogy with the built-in predicate atom_codes/2, the second argument of which is a list of character codes.

The C header generated by splfr from the foreign/[2,3] facts now uses the const attribute where appopriate.

Foreign resources are no longer unloaded by save_program/[1,2]. For this reason, the deinit function of a foreign resource is no longer called when saving a program so SP_WHEN_SAVE has been removed.

14.1.5.2 C API Functions

Many functions in the C API has been changed or removed, especially those related to OS and I/O operations. There are also a number of new C API functions.

Old APIReplaced by
SP_make_stream, SP_make_stream_contextSP_create_stream
SP_set_ttySP_CREATE_STREAM_OPTION_INTERACTIVE
SP_fgetcSP_get_byte, SP_get_code
SP_fputcSP_put_byte, SP_put_code
SP_fputsSP_put_codes, SP_put_encoded_string
SP_fflushSP_flush_output
SP_chdirSP_set_current_dir
SP_getcwdSP_get_current_dir
SP_set_wcx_hooksGone
SP_wcx_getc, SP_wcx_putcGone
SP_to_os, SP_from_osGone
SP_put_number_charsSP_put_number_codes
SP_get_number_charsSP_get_number_codes

Other new functions include:

SP_get_stream_user_data
SP_get_stream_counts
SP_put_bytes
SP_fopen
SP_unget_code
SP_unget_byte

Also, many functions take new or changed parameters.

14.1.5.3 Java API


Send feedback on this subject.