libffi
sol2
Our great sponsors
libffi | sol2 | |
---|---|---|
11 | 17 | |
2,755 | 3,376 | |
2.2% | - | |
9.5 | 6.4 | |
about 1 month ago | about 1 month ago | |
C | C++ | |
GNU General Public License v3.0 or later | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
libffi
-
Error when installing .deb
Ok, there is a missing dependency, libffi6, which cannot be installed, because it isn't at repos. You can either install it via downloading from other repos (there is a chance in the debian repo), or via compiling on your own (you can start with paying a visit to official site: https://sourceware.org/libffi/). Either way, move carefully and never forget when a dependency is missing, it may be a start of a "missing dependencies hell". And please, be caution, because you can break your system quite easily.
-
Your favorite binding?
I've been working in implementing libffi into Euphoria so we can call Raylib functions directly. Previously, Euphoria did not support passing structures by value and only occasionally could we get away with "faking" it by passing int type values directly (but not float types). Raylib is the first library I've run into that makes heavy use of passing structures by value, so it's been an interesting challenge. My original proof of concept worked well with libffi built as a shared library, so now I'm working on building libffi directly into the backend of Euphoria. Then we'll be off and running with full support for Raylib!
-
kivy-ios / initial build with toolchain keeps getting stuck here (checking for suffix of executables...) after updating macOS and xcode... any thoughts? Thanks!
The last line of output is from configure and appears to be during building of libffi recipe - apparently executing the generate-darwin-source-and-headers.py from libffi repository
-
Installing Python in Ubuntu 20.04
build-essential installs everything required for compiling basic software written in C and C++ in this case Python. Read more... zlib1g-devis the development package of the compression library that implements the deflate compression methods and essential in Python's installation and other installations as well. Read more... libncurses5-dev is the development package for the curses library that provides a terminal-independent screen-painting and keyboard-handling tool. Read more... libgdbm-dev is a development library for GDBM whose functionality is to store key/data pairs in a data file. Read more... libnss3-dev Read more... libssl-dev Read more... libreadline-dev Read more... libffi-dev Read more... libsqlite3-dev Read more... wget Read more... libbz2-dev Read more... In the next step we can either manually download the latest release of Python from the Python Official Release page or use wget which we have installed in previous command. To download using wget, paste the following command in the terminal to download Python in the computer.
-
buildozer -v android debug error
[INFO]: -> running basename https://github.com/libffi/libffi/archive/v3.3.tar.gz
-
Julia ❤ Python
If you have read my earlier posts you know I love multilingual programming. One important part of multilingual programming is how to interface one language with other. Typically this is called FFI or foreign function interface. At the lowest level often there are libraries (aka bindings) to talk across languages or across implementations of same language e.g. libffi. In my undergrad we did a group project where we created language bindings to separate algorithmic part written in python and opencv and X11 logic in c.
sol2
-
CBN Changelog: December 3, 2022. Improved LUA support in progress!
This version relies on a Lua C++ wrapper called sol2 to hide Lua stack management from the developer, so creating new bindings can be done by adding a few lines of human-readable C++. It still has to be done manually, but at least sol2 is able to automatically figure out types of objects being bound, so it's not much different from our de-/serialization code.
- RTS programming game where you write real C++ code to control your player.
-
Tools for rolling your own engine
Here is link number 2 - Previous text "Sol"
Sol for fast lua embedding
-
jluna: a new Julia <-> C++ Wrapper
It is half of a pun as I was inspired by [sol3](https://github.com/ThePhD/sol2) which is a lua <-> c++ wrapper. Sol means sun and the julia c-api prefixes all it's functions with jl, luna means moon so it is pronounced "jay luna"
So far, it has been cumbersome to embed it into C-language projects, because it's C-interface is hard to use and poorly documented. Because of this, many choose to just use python or lua instead.
-
A new C++ <-> Julia Wrapper: jluna
If you want to be portable I'd recommend C++ and Lua, I used those for years and it runs on everything and there's this most amazing wrapper API which was a huge inspiration
-
Why the C Language Will Never Stop You from Making Mistakes
Off topic, but this is the author of my favourite Lua C++ binding library (https://github.com/ThePhD/sol2). Great guy!
-
Sayonara, C++, and Hello to Rust
I mean, if you could tell from my original post, I like C++ templates. The point is not to constantly write templates in your calling code, the point is to architect a library with templates that affords flexibility and dynamism so that the calling code is easy to write, read, and reason about. Consider, for example, the sol2[0] example usage code vs the actual source code itself[1].
-
Design Issues for Foreign Function Interfaces (2004)
Very interesting article!
Unfortunately, it doesn't mention Lua, which in my opinion has one of the most elegant C APIs that I have seen. It is entirely stack based, which means you only need to work with primitive types, such as numbers, C strings and user provided opaque pointers. As a consequence, you never have to care about memory management because Lua doesn't even let you access the actual Lua objects.
You want to create a table (= Lua's dictionary/array hybrid) and set a field "foo" to 5? lua_newtable() creates a new table and pushes it onto the stack. Then you push "foo" with lua_pushstring() and 5 with lua_pushnumber(). Finally you call lua_settable(), which pops the key and value from the stack, checks if the top of the stack contains a table, and if yes, sets the given field to the given value. The actual table structure is never exposed!
This kind of stack manipulation might seem unusual and a bit unweildy, but what you get is safety. If you mess up the stack or perform illegal operations, Lua will call an error handler, but the VM should never crash. The stack API can be seen as the fundamental layer upon which people can create nice abstractions for their host language of choice. Examples are "sol2" for C++ (https://github.com/ThePhD/sol2) or "lupa" for Python (https://github.com/scoder/lupa)
The public API is contained in "lua.h": https://github.com/lua/lua/blob/master/lua.h. "lauxlib.h" offers some useful helper functions: https://github.com/lua/lua/blob/master/lauxlib.h
For comparison, this is Python's "Limited" C API: https://docs.python.org/3/c-api/stable.html#stable
If you want to learn more about Lua's C API, have a look at section 4 in https://www.lua.org/manual/5.4/manual.html
What are some alternatives?
SWIG - SWIG is a software development tool that connects programs written in C and C++ with a variety of high-level programming languages.
Lua - Lua is a powerful, efficient, lightweight, embeddable scripting language. It supports procedural programming, object-oriented programming, functional programming, data-driven programming, and data description.
ChaiScript - Embedded Scripting Language Designed for C++
pybind11 - Seamless operability between C++11 and Python
Wren - The Wren Programming Language. Wren is a small, fast, class-based concurrent scripting language.
V8 - The official mirror of the V8 Git repository
CppSharp - Tools and libraries to glue C/C++ APIs to high-level languages
nbind - :sparkles: Magical headers that make your C++ library accessible from JavaScript :rocket:
djinni