Debian Codegraph @

docs_sphinx/advanced/interface.rst

raw
1 Interfacing with external code
2 ==============================
3
4 Some neural simulations benefit from a direct connections to external libraries,
5 e.g. to support real-time input from a sensor (but note that Brian currently
6 does not offer facilities to assure real-time processing) or to perform
7 complex calculations during a simulation run.
8
9 If the external library is written in Python (or is a library with Python
10 bindings), then the connection can be made either using the mechanism for
11 :ref:`user_functions`, or using a :ref:`network operation <network_operation>`.
12
13 In case of C/C++ libraries, only the :ref:`user_functions` mechanism can be
14 used. On the other hand, such simulations can use the same user-provided C++
15 code to run with the
16 :ref:`cpp_standalone` mode. In addition to that code, one generally needs to
17 include additional header files and use compiler/linker options to interface
18 with the external code. For this, several preferences can be used that will be
19 taken into account for ``cython`` and the ``cpp_standalone`` device.
20 These preferences are mostly equivalent to the respective keyword arguments for
21 Python's `distutils.core.Extension` class, see the documentation of the
22 `~brian2.codegen.cpp_prefs` module for more details.