summaryrefslogtreecommitdiff
path: root/doc/ref/api-foreign.texi
AgeCommit message (Collapse)AuthorFilesLines
2024-10-26doc: Fix typo in FFI documentation.Nikolaos Chatzikonstantinou1-1/+1
The incorrect procedure is mentioned; see the example that immediately follows. * doc/ref/api-foreign.texi (Foreign Functions): fix typo to pointer->procedure. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-05-06Fix typos throughout codebase.Morgan Smith1-9/+9
* NEWS: * doc/ref/api-control.texi: * doc/ref/api-data.texi: * doc/ref/api-debug.texi: * doc/ref/api-deprecated.texi: * doc/ref/api-evaluation.texi: * doc/ref/api-foreign.texi: * doc/ref/api-i18n.texi: * doc/ref/api-io.texi: * doc/ref/api-languages.texi: * doc/ref/api-macros.texi: * doc/ref/api-memory.texi: * doc/ref/api-modules.texi: * doc/ref/api-options.texi: * doc/ref/api-peg.texi: * doc/ref/api-procedures.texi: * doc/ref/api-scheduling.texi: * doc/ref/api-undocumented.texi: * doc/ref/api-utility.texi: * doc/ref/expect.texi: * doc/ref/goops.texi: * doc/ref/misc-modules.texi: * doc/ref/posix.texi: * doc/ref/repl-modules.texi: * doc/ref/scheme-ideas.texi: * doc/ref/scheme-scripts.texi: * doc/ref/srfi-modules.texi: * gc-benchmarks/larceny/dynamic.sch: * gc-benchmarks/larceny/twobit-input-long.sch: * gc-benchmarks/larceny/twobit.sch: * libguile/gc.h: * libguile/ioext.c: * libguile/list.c: * libguile/options.c: * libguile/posix.c: * libguile/threads.c: * module/ice-9/boot-9.scm: * module/ice-9/optargs.scm: * module/ice-9/ports.scm: * module/ice-9/pretty-print.scm: * module/ice-9/psyntax.scm: * module/language/elisp/parser.scm: * module/language/tree-il/compile-bytecode.scm: * module/srfi/srfi-37.scm: * module/srfi/srfi-43.scm: * module/statprof.scm: * module/texinfo/reflection.scm: * test-suite/tests/eval.test: * test-suite/tests/fluids.test: Fix typos. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-03-17Expose read-c-struct, write-c-struct syntaxAndy Wingo1-9/+49
* module/system/foreign.scm (read-c-struct): Rename from read-fields. Export. (write-c-struct): Rename from write-fields. Export. (%write-c-struct, %read-c-struct): Add % prefix to these private bindings.
2021-11-15Support C99 complex types in (system foreign)Daniel Llorens1-1/+4
* libguile/foreign.h (SCM_FOREIGN_TYPE_COMPLEX_FLOAT, SCM_FOREIGN_TYPE_COMPLEX_DOUBLE): New enums. * module/system/foreign.scm (complex-float, complex-double): Export new types. (make-c-struct, parse-c-struct): Support the new types. * libguile/foreign.c (complex-float, complex-double): Define new types. (alignof, sizeof, pack, unpack): Support the new types. * test-suite/tests/foreign.test: Test.
2021-11-03Fix typos in SRFI docsArun Isaac1-1/+1
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=50127 * doc/ref/api-foreign.texi, doc/ref/srfi-modules.texi: Fix typos.
2021-03-13On Cygwin, 'lib' DLLs use 'cyg' prefixMike Gran1-0/+6
When using automake and libtool to build DLLs on Cygwin, libtool will rename libXXX to cygXXX. 'load-foreign-library' should emulate libltdl behavior and search for DLLs using that convention. * module/system/foreign-library.scm (lib->cyg): new helper function (load-foreign-library): add rename-on-cygwin? option to rename libraries using Cygwin semantics * test-suite/tests/foreign.test: new test section 'lib->cyg' * doc/ref/api-foreign.text: document new rename-on-cygwin? option for load-foreign-library
2021-02-03Replace libltdl with raw dlopen, dlsymAndy Wingo1-520/+436
* NEWS: Update. * am/bootstrap.am (SOURCES): * module/Makefile.am (SOURCES): Add system/foreign-library.scm. * configure.ac: Replace ltdl check with -ldl check. * libguile/dynl.c: Rewrite to just expose core dlopen / dlsym / etc to a helper Scheme module. (scm_dynamic_link, scm_dynamic_pointer, scm_dynamic_function) (scm_dynamic_object_p, scm_dynamic_call): Rewrite in terms of (system foreign-library). * libguile/extensions.c (load_extension): Avoid scm_dynamic_call. * module/system/foreign-library.scm: New file. * module/oop/goops.scm (<dynamic-object>): Hackily export <foreign-library> instead of a class here. * doc/ref/api-foreign.texi (Foreign Function Interface): Rewrite to only document the new interfaces. Eventually we will deprecate dynamic-link and friends. * doc/ref/guile.texi (API Reference): Move Foreign Objects after Foreign Function Interface. Seems there should be some closer relationship but this will do for now. * doc/ref/tour.texi (Putting Extensions into Modules): * doc/ref/libguile-parallel.texi (Parallel Installations): Update for rename of Modules and Extensions to Foreign Extensions. * libguile/deprecated.h: * libguile/deprecated.c (scm_dynamic_unlink): Deprecate. * libguile/guile.c: Remove ltdl include. * test-suite/tests/foreign.test: Update tests to use new API, and update error expectations.
2020-03-22Interpret dynamic library name as literal file name first.Isaac Jurado1-5/+8
Fixes <https://bugs.gnu.org/21076>. * libguile/dynl.c (sysdep_dyn_link): Try plain lt_dlopen first, to interpret fname as a literal path. * doc/ref/api-foreign.texi: Update explanation to describe the new behavior. Co-authored-by: Ludovic Courtès <ludo@gnu.org>
2017-11-22foreign: Add 'uintptr_t' and 'intptr_t'.Matt Wette1-0/+2
* libguile/foreign.c (scm_uintptr_t, scm_intptr_t): New variables. (scm_init_foreign): Define them. * module/system/foreign.scm: Export 'intptr_t' and 'uintptr_t'. * doc/ref/api-foreign.texi (Foreign Types): Document them. Co-authored-by: Ludovic Courtès <ludo@gnu.org>
2017-06-11doc: Document 'short' and 'unsigned-short' foreign types.Mark H Weaver1-0/+2
This is a followup to commit 42f7c01e0a1d1c139ec8b835429a80ab15ac4007. Reported by Adriano Peluso <catonano@gmail.com>. * doc/ref/api-foreign.texi (Foreign Types): Add missing entries for 'short' and 'unsigned-short'.
2017-03-05Can't recursively search DLLs with FFI on CygwinMike Gran1-1/+6
* doc/ref/api-foreign.text (dynamic-link): document problems with recursive DLLs. * test-suite/standalone/test-ffi (global): with Cygwin, dynamic-link C library explicitly * test-suite/standalone/test-foreign-object-scm (libc-ptr): with Cygwin, link C library explicitly * test-suite/tests/foreign.test (qsort): with Cygwin, link C library explicitly
2016-12-18FFI: Add support for functions that set 'errno'.Mark H Weaver1-4/+11
Implements wishlist item <https://debbugs.gnu.org/18592>. Requested by Frank Terbeck <ft@bewatermyfriend.org>. Based on a proposed patch by Nala Ginrut <nalaginrut@gmail.com>. Patch ported to 2.2 by Andy Wingo <wingo@pobox.com>. * libguile/foreign.c (cif_to_procedure): Add 'with_errno' argument. If true, truncate result to only one return value. (scm_i_foreign_call): Separate the arguments. Always return errno. (pointer_to_procedure): New static function. (scm_pointer_to_procedure_with_errno): New C API function, implemented in terms of 'pointer_to_procedure'. (scm_pointer_to_procedure): Reimplement in terms of 'pointer_to_procedure', no longer bound to "pointer->procedure". See below. (scm_i_pointer_to_procedure): New C function bound to "pointer->procedure" which now accepts the optional #:return-errno? keyword argument, implemented in terms of 'pointer_to_procedure'. (k_return_errno): New keyword #:return-errno?. * libguile/foreign.h (scm_pointer_to_procedure_with_errno): Add prototype. * doc/ref/api-foreign.texi (Dynamic FFI): Adjust documentation. * libguile/vm-engine.c (foreign-call): Return two values.
2016-07-25doc: Do not gender the programmer.Ricardo Wurmus1-1/+1
* doc/ref/api-foreign.texi: Replace "his" with "their". * doc/ref/sxml.texi: Likewise.
2014-02-27Fix typo in manual.Mark H Weaver1-1/+1
* doc/ref/api-foreign.texi (Void Pointers and Byte Access): (rnrs bytevector) --> (rnrs bytevectors).
2014-02-08Deprecate general "uniform-vector" interfaceAndy Wingo1-7/+5
* libguile/uniform.h: * libguile/uniform.c (scm_is_uniform_vector, scm_uniform_vector_p) (scm_c_uniform_vector_length, scm_uniform_vector_length) (scm_uniform_vector_element_type, scm_uniform_vector_element_size) (scm_c_uniform_vector_ref, scm_uniform_vector_ref): (scm_c_uniform_vector_set_x, scm_uniform_vector_set_x): (scm_uniform_vector_to_list) (scm_uniform_vector_elements, scm_uniform_vector_writable_elements): Deprecate. This interface lacked both generality and specificity. The general replacement is array-length, array-ref, and friends on the scheme side, or the array handle interface on the C side. On the specific side of things, there are the specific bytevector, srfi-4, and bitvector interfaces. * test-suite/tests/arrays.test: * test-suite/tests/bitvectors.test: * test-suite/tests/ports.test: * test-suite/tests/srfi-4.test: Update to use array interfaces. * doc/ref/api-foreign.texi (Void Pointers and Byte Access): * doc/ref/srfi-modules.texi (SRFI-4): Update.
2013-02-14update old references in FFI docDaniel Hartwig1-2/+2
* doc/ref/api-foreign.texi (Foreign Types): Replace references to the old foreign->bytevector and bytevector->foreign with the new procedure names using pointer.
2013-02-02Add foreign types: ssize_t and ptrdiff_t.Mark H Weaver1-0/+2
* libguile/foreign.c (sym_ssize_t, sym_ptrdiff_t): New symbols. (scm_init_foreign): Add bindings for ssize_t and ptrdiff_t. * module/system/foreign.scm: Export ssize_t and ptrdiff_t. * doc/ref/api-foreign.texi (Foreign Types): Add docs.
2013-01-23fix dynamic-call docAndy Wingo1-4/+1
* doc/ref/api-foreign.texi (Foreign Functions): Fix doc: interrupts are not deferred in a dynamic-call.
2012-07-04add scm_{to,from}_pointer docsAndy Wingo1-0/+16
* doc/ref/api-foreign.texi: Add documentation for scm_to_pointer and scm_from_pointer.
2012-02-12Fix manual: scm_foreign_to_bytevector to scm_pointer_to_bytevectorMark H Weaver1-1/+1
* doc/ref/api-foreign.texi (Void Pointers and Byte Access): Fix outdated function name: scm_foreign_to_bytevector to scm_pointer_to_bytevector.
2012-02-04Improve consistency of definitions of C functions in manual.Bake Timmons1-6/+6
* doc/ref/api-compound.texi * doc/ref/api-evaluation.texi * doc/ref/api-foreign.texi * doc/ref/api-io.texi * doc/ref/posix.texi * doc/ref/srfi-modules.texi: Add missing parentheses and commas to definitions of C functions. * doc/ref/api-data.texi: Change from @deffn to @deftypefn for C function with arguments not of SCM type.
2012-01-27more documentation on the process of loading source and compiled filesAndy Wingo1-5/+5
* doc/ref/api-evaluation.texi (Load Paths): Move documentation of %load-path and related procedures here, from Build Config. Add docs for %load-compiled-path. * doc/ref/api-foreign.texi: * doc/ref/api-modules.texi: * doc/ref/api-options.texi: * doc/ref/scheme-using.texi: Update xrefs.
2012-01-03doc: Fix typo in `define-wrapped-pointer-type' example.Ludovic Courtès1-2/+2
* doc/ref/api-foreign.texi (Void Pointers and Byte Access): Fix typo in `define-wrapped-pointer-type' example.
2011-04-01string->pointer and pointer->string have optional encoding argAndy Wingo1-9/+11
* test-suite/tests/foreign.test ("pointer<->string"): Add test cases. * libguile/foreign.c (scm_string_to_pointer, scm_pointer_to_string): Add optional encoding, and in the pointer->string case, length arguments. * libguile/foreign.h: Update prototypes of internal functions. Shouldn't affect ABI as they are internal. * doc/ref/api-foreign.texi (Void Pointers and Byte Access): Update docs.
2011-03-17add pointer->scm, scm->pointerAndy Wingo1-0/+14
* libguile/foreign.c (scm_pointer_to_scm, scm_scm_to_pointer): New functions, useful to pass and receive SCM values to and from foreign functions. * module/system/foreign.scm: Export the new functions. * doc/ref/api-foreign.texi (Foreign Variables): Add docs. * test-suite/tests/foreign.test ("pointer<->scm"): Tests.
2011-03-02Improve the documentation for `dynamic-link'.Ludovic Courtès1-3/+10
* doc/ref/api-foreign.texi (Foreign Libraries): Make it clear that the LIBRARY argument of `dynamic-link' should not contain an extension. (Foreign Functions): Add cross-reference from `load-extension' to `dynamic-link'. Typeset file names and module names correctly.
2011-02-20@value{EFFECTIVE-VERSION} instead of 2.0 in some places in the manualAndy Wingo1-3/+3
* doc/ref/history.texi (A Timeline of Selected Guile Releases): Update the 2.0 release blurb. * doc/ref/api-foreign.texi (Modules and Extensions): * doc/ref/libguile-extensions.texi (A Sample Guile Extension): * doc/ref/tour.texi (Linking Guile into Programs): Use @value{EFFECTIVE-VERSION} instead of 2.0. Also fix sample extension compilation line to include the Guile CFLAGS.
2011-02-08Have `define-wrapped-pointer-type' take a type name.Ludovic Courtès1-2/+3
* module/system/foreign.scm (define-wrapped-pointer-type): Add a `type-name' argument instead of non-hygienically generating one. * test-suite/tests/foreign.test (foo): Update. * doc/ref/api-foreign.texi (Void Pointers and Byte Access): Update accordingly.
2011-01-30Add `pointer?'.Ludovic Courtès1-0/+4
* libguile/foreign.c (scm_pointer_p): New function. * libguile/foreign.h (scm_pointer_p): New declaration. * module/system/foreign.scm: Export `pointer?'. * test-suite/tests/foreign.test ("null pointer")["pointer?"]: New test. ("make-pointer")["pointer?"]: New test. * doc/ref/api-foreign.texi (Foreign Variables): Document `pointer?'.
2011-01-30Add `define-wrapped-pointer-type'.Ludovic Courtès1-2/+72
* module/system/foreign.scm (define-wrapped-pointer-type): New macro. * doc/ref/api-foreign.texi (Foreign Types): Mention the `*' symbol. (Void Pointers and Byte Access): Document `define-wrapped-pointer-type'. * test-suite/tests/foreign.test ("define-wrapped-pointer-type"): New test prefix.
2010-10-31Manual sections don't need a page break beforeNeil Jerram1-1/+0
* doc/ref/api-coverage.texi (Code Coverage): Remove @page. * doc/ref/api-foreign.texi (Foreign Function Interface): Ditto. * doc/ref/api-lalr.texi: (LALR(1) Parsing): Ditto. * doc/ref/api-macros.texi (Macros): Ditto.
2010-10-26Fix manual typoNeil Jerram1-1/+1
* doc/ref/api-foreign.texi: "prodedures" -> "procedures".
2010-09-06Rename `make-foreign-function' to `pointer->procedure'.Ludovic Courtès1-14/+14
* libguile/foreign.c (scm_make_foreign_function): Rename to... (scm_pointer_to_procedure): ... this. * libguile/foreign.h: Adjust accordingly. * module/system/foreign.scm: Likewise. * test-suite/standalone/test-ffi: Likewise. * test-suite/tests/foreign.test: Likewise. * doc/ref/api-foreign.texi: Likewise.
2010-09-03Add `procedure->pointer' to the FFI.Ludovic Courtès1-2/+66
* libguile/foreign.c (make_cif): New procedure, with code formerly in `scm_make_foreign_function'. (scm_make_foreign_function): Use it. (invoke_closure, scm_procedure_to_pointer)[FFI_CLOSURES]: New functions. * libguile/foreign.h (scm_procedure_to_pointer): New declaration. * module/system/foreign.scm: Export `procedure->pointer' when available. * test-suite/standalone/test-ffi (f-callback-1, f-callback-2): New procedures and related tests. * test-suite/standalone/test-ffi-lib.c (test_ffi_callback_1, test_ffi_callback_2): New functions. * test-suite/tests/foreign.test ("procedure->pointer"): New test prefix. * doc/ref/api-foreign.texi (Dynamic FFI): Document `procedure->pointer'.
2010-08-15Add `string->pointer' and `pointer->string' to the FFI.Ludovic Courtès1-0/+16
* libguile/foreign.c (scm_string_to_pointer, scm_pointer_to_string): New functions. * libguile/foreign.h (scm_string_to_pointer, scm_pointer_to_string): New declarations. * module/system/foreign.scm: Export `string->pointer' and `pointer->string'. * test-suite/tests/foreign.test ("pointer<->string"): New test prefix. * doc/ref/api-foreign.texi (Void Pointers and Byte Access): Add `string->pointer' and `pointer->string'.
2010-08-06add docs for extensiondir; misc other fixesAndy Wingo1-33/+27
* libguile/foreign.c (scm_i_pointer_print): Print in hexadecimal. * doc/ref/api-foreign.texi (Modules and Extensions): Update for "extensiondir", and a discussion of Guile versions. (Foreign Variables): Fix discussion of types. (Void Pointers and Byte Access): Fix typo.
2010-08-06remove type discusison from dynamic-pointer docstringAndy Wingo1-5/+0
* doc/ref/api-foreign.texi: * libguile/dynl.c (scm_dynamic_pointer): Remove discussion of types from the docstring.
2010-07-28Update the FFI doc.Ludovic Courtès1-108/+83
* doc/ref/api-foreign.texi (Foreign Types): Remove bits about typed foreign pointers. Add `void'. (Foreign Variables): Update the doc of `dynamic-pointer' and the `numptob' example. Remove `foreign-set!' and `foreign-ref'. Add `pointer-address', `make-pointer', `%null-pointer', and `null-pointer?' (Void Pointers and Byte Access): Make it clear that wrapped pointers are untyped. Remove `void' from here. Replace `foreign->bytevector' and `bytevector->foreign' by `pointer->bytevector' and `bytevector->pointer'. Add `dereference-pointer' and the rest of the `numptob' example. (Dynamic FFI): Update examples. Remove `%null-pointer' from here. * libguile/dynl.c (scm_dynamic_pointer): Update docstring. * libguile/foreign.c (scm_dereference_pointer, scm_pointer_to_bytevector): Likewise. * module/system/foreign.scm (null-pointer?): Add docstring.
2010-06-01rename (rnrs bytevector) to (rnrs bytevectors)Andy Wingo1-1/+1
* module/rnrs/bytevectors.scm: Rename to (rnrs bytevectors), from (rnrs bytevector), to match the name from the R6RS. * benchmark-suite/benchmarks/bytevectors.bm: * doc/ref/api-data.texi: * doc/ref/api-foreign.texi: * libguile/bytevectors.c: * module/6/rnrs.scm: * module/language/assembly.scm: * module/language/assembly/compile-bytecode.scm: * module/language/assembly/decompile-bytecode.scm: * module/language/glil/compile-assembly.scm: * module/language/tree-il/primitives.scm: * module/srfi/srfi-4.scm: * module/srfi/srfi-4/gnu.scm: * module/system/foreign.scm: * test-suite/standalone/test-ffi: * test-suite/tests/asm-to-bytecode.test: * test-suite/tests/bytevectors.test: * test-suite/tests/foreign.test: * test-suite/tests/r6rs-ports.test: Update all referrers.
2010-04-06finish ffi docsAndy Wingo1-71/+206
* libguile/foreign.c: Some doc tweaks. * doc/ref/api-foreign.texi: Finish FFI docs.
2010-04-06more ffi docsAndy Wingo1-53/+246
* libguile/foreign.c (scm_make_foreign_function): Doc a little. * doc/ref/api-foreign.texi (Foreign Function Interface): Document some more.
2010-04-02deprecate dynamic-args-call, and update docs some moreAndy Wingo1-33/+24
* libguile/deprecated.h (scm_dynamic_args_call): Deprecate. * libguile/deprecated.c: * libguile/dynl.h: * libguile/dynl.c: * doc/ref/api-foreign.texi: More doc updates.
2010-04-02add api-foreign.texiAndy Wingo1-0/+512
* doc/ref/api-foreign.texi: New file. * doc/ref/api-modules.texi: Reorganize bits about dynamic linking into api-foreign. * doc/ref/guile.texi: * doc/ref/Makefile.am: Adapt to api-foreign.texi.