Questions tagged [language-binding]
43 questions
67
votes
4 answers
What is a language binding?
My good friend, Wikipedia, didn't give me a very good response to that question. So:
What are language bindings?
How do they work?
Specifically accessing functions from code written in language X of a library written in language Y.

Daniel
- 1,155
- 1
- 10
- 15
27
votes
4 answers
CUDA bindings for .net?
I know that there are a lot of CUDA language bindings, such as PyCUDA, but are there any good bindings for .Net? The only one I've seen is this one, but I'd like to know if there are any others.

TraumaPony
- 10,742
- 12
- 54
- 74
17
votes
5 answers
ctypes return a string from c function
I'm a Python veteran, but haven't dabbled much in C. After half a day of not finding anything on the internet that works for me, I thought I would ask here and get the help I need.
What I want to do is write a simple C function that accepts a string…

Thane Brimhall
- 9,256
- 7
- 36
- 50
14
votes
4 answers
Symbolic Computation Library in pure C
Does there exist a symbolic computation library written pure C? Symbolic computation as in manipulating mathematical equations in symbolic form.
I know there is Mathematica, and Sympy. But, I am interested in creating in a high performance pure C…

rudolph9
- 8,021
- 9
- 50
- 80
9
votes
1 answer
Running C code in Elixir/Erlang: Ports or NIFs?
I've found that Elixir programs can run C code either via NIFs (native implemented functions) or via OS-level ports. Having read those and similar links, I'm not a hundred percent clear on when to use one or the other method (or something else…

Vivian
- 1,539
- 14
- 38
8
votes
1 answer
Iterating over std::map in PHP with SWIG
I am using SWIG to wrap a function that returns an std::map in PHP.
In the PHP code, I need to iterate over the elements of the map.
Thw SWIG library provides support for std::map with the std_map.i interface file, but only the following methods are…

HighCommander4
- 50,428
- 24
- 122
- 194
7
votes
2 answers
What kinds of C++ functions can be placed in a C function pointer?
I have a C library that uses a struct of function pointers for callbacks. The callbacks will be called from C code.
extern "C" {
typedef struct callbacks_t {
void (*foo) (const char*);
int (*bar) (int);
} callbacks_t;
}// extern C
What…

user1526370
- 73
- 3
6
votes
1 answer
template type as struct data member in SWIG
I am writing a PHP wrapper for a C++ library using SWIG, but I am having trouble using a structure with an instance of a template type as a data member.
Suppose I have the following header file:
template
struct myvector
{
};
struct S
{
…

HighCommander4
- 50,428
- 24
- 122
- 194
5
votes
3 answers
Languaged bindings involving non-gced memory for languages without guaranteed destructors?
When someone is making bindings from a C library to Java (or any other garbage-collected language without destructors that are guaranteed to run), how do they deal with proper deallocation of non-garbage-collected memory?
EDIT:
What I'm thinking of…

compman
- 2,174
- 2
- 18
- 26
5
votes
0 answers
How can I write a library usable from multiple languages?
I am trying to write a library which can be used from multiple programming languages, for example:
CLR languages (C#, F#..)
JVM languages (Java, Kotlin, Scala..)
Native languages (C/C++, Rust, Objective-C, Swift..)
JavaScript/TypeScript
The basic…

Jesse
- 6,725
- 5
- 40
- 45
5
votes
1 answer
What is PyObjC?
I understand the concept of PyObjC, but can nowhere find any information on what exactly it is or how to get started with it.
Is it like a converter, where youinput python files and get an objective c one?
Or is it a library you can import to your…

lavelle
- 1,446
- 1
- 17
- 30
3
votes
2 answers
Catching fortran runtime errors and signals in C++ binding
I would like to be able to catch a terminating Fortran runtime errors in a C++ binding.
I have a legacy F90 code to bind to and expect all kind of errors e.g. numerical, IO etc.
I managed to handle STOP according to:
Intercepting Fortran STOP from…

levego70
- 41
- 3
2
votes
1 answer
extending 'incomplete' types (SWIG)
I'm looking for a way to extend (i.e. add new members to a type using the %extend directive) a type that is defined in the library file itself while the header files of the library provide only a forward declaration for the type.
Treating the type…

arov00
- 169
- 1
- 8
2
votes
0 answers
Path problems when loading a native library from inside Python package
A project I contribute to is using a Rust language bindings library called UniFFI to create Python language bindings from Rust code. The crate produces a native library (say libtinymath.dylib) and a Python module (say tinymath.py which imports and…

thunderbiscuit
- 89
- 6
2
votes
0 answers
Writting a wrapper for a customized lua-based scripting language
I have a program which is an extension of Lua, i.e. it includes a bunch of additional objects and functions. This program can now be used to execute lua scripts which make use of the additional features on top of standard lua. A generic example for…

user2224350
- 2,262
- 5
- 28
- 54