forked from okeuday/GEPD
-
Notifications
You must be signed in to change notification settings - Fork 0
Automatically generate an Erlang port driver or Erlang port for C/C++ bindings using a single self-contained file
License
mattsta/generic-erlang-port--driver-
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
GENERIC ERLANG PORT [DRIVER] (GEP[D]), VERSION 0.7 (Jan 22 2011) PURPOSE ------------------------------------------------- To automatically generate an Erlang port driver or Erlang port for C/C++ bindings using a single self-contained file. Files: test_bindings.h contains the ONLY configuration to support the C functions in test_functions.h and test_functions.c test_bindings.erl provides the gen_server to manage the port or port driver erlang_functions_hrl.h creates the erlang function interface port_driver.cpp provides the Erlang port driver implementation port.cpp and port.hpp provide the Erlang port implementation Whether PORT_DRIVER_NAME_PREFIX or PORT_NAME_PREFIX is defined determines if a port driver or port is built, respectively (in test_bindings.h). If both are defined, a port driver is built. Features: - a function binding with only a single line tuple - efficient passing of function types with no intermediate character buffer - functionality like the Erlang Driver Tool Kit (EDTK) (no fd handling though) - macro expansion to avoid code duplication errors - floating point type handling - stdout/stderr handling in the generated port code Caveat: The generated port driver code can not be used for hot code updating if it performs an asynchronous call because erts will lock the driver (making it "permanent") with driver_lock_driver() (http://erlang.org/doc/man/erl_driver.html#driver_lock_driver). With the driver locked, there is no possibility that an async operation would create instability after a hot code update. BUILDING ------------------------------------------------- Some of the newer features in port_driver.cpp require erts >= 5.6. Boost is required for the preprocessor macro expansion code (http://www.boost.org/). To build with cmake: mkdir build cd build cmake .. make To build with the make script: ./make.sh RUNNING ------------------------------------------------- The test_bindings code should generate output similar to: $ erl +A 16 Erlang R13B02 (erts-5.7.3) [source] [64-bit] [smp:4:4] [rq:4] [async-threads:16] [kernel-poll:false] Eshell V5.7.3 (abort with ^G) 1> test_bindings:start(). using port driver {ok,<0.35.0>} 2> test_bindings:test(). sync sleep async sleep ... ok 3> async function call returned: {ok,ok} 3> LICENSE ------------------------------------------------- BSD license CONTACT ------------------------------------------------- Michael Truog <mjtruog at gmail dot com>
About
Automatically generate an Erlang port driver or Erlang port for C/C++ bindings using a single self-contained file
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published
Languages
- C++ 72.3%
- Erlang 14.9%
- C 12.0%
- Shell 0.8%