Hot answers tagged

69

C has a much, much simpler interface, and its rules for converting a source code interface into a binary interface are straightforward enough that generating external interfaces to bind to is done in a well-established manner. C++, on the other hand, has an incredibly complicated interface, and the rules for ABI binding are not standardized at all, neither ...


44

You have a few options: Create an HTTP interface, almost everything can talk HTTP so that will get you a lot of languages. Create something that can be linked into a language runtime, this will be rather time consuming as you will need to find a way to connect it to many different languages.


32

If you're trying to communicate with a speaker of another language, pidgin is easier than Shakespearean English. C's concepts - function calls, pointers, NULL-terminated strings - are very straightforward, so other languages can easily implement them well enough to call C functions. For historical reasons, many other languages are implemented in C, which ...


30

I think C or C++ would be most suitable for your purpose. You can use SWIG (Simplified Wrapper and Interface Generator) to generate language bindings from your C or C++ API. SWIG is a software development tool that connects programs written in C and C++ with a variety of high-level programming languages. SWIG is used with different types of target ...


23

There are pretty much 2 ways: a C API. Practically ever language there ever was will load a C library and call its functions. How you do this depends on the source language. a RPC mechanism of some sort. This can be a REST API running over HTTP, or a binary interface running over a socket. Unless you go for the lowest common denominator mechanism (eg a ...


21

C is one of the oldest languages still around. Its ABI is simple, and virtually every operating system still in use today has been written in it. While some of those OS's may have added stuff e.g. in C#/.NET or whatever on-top, down below they're very much steeped in C. That means that, in order to use the functionality provided by the OS, virtually every ...


12

If performance and call latency is not an issue, consider providing a comprehensive command line interface (probably, using a scripting language on top of it). ImageMagick can be a good example of such an "API". Another good example is Tk toolkit.


6

Leaving out the details other answers already provide: The reason so many languages provides a C binding is that all *nix and Windows operating systems expose most of their OS API via a C interface. So the language implementation already needs to interface with C to be able to run on the major Oses. Therefore, it is straightforward to also offer directly ...


5

There is no reason. If the semantics you're trying to express are fundamentally C-compatible and not something like templates, there is no reason you can bind easier if the implementation is written in C. In fact, it's pretty much by definition that a C interface can be filled out by any implementation that can meet the binary contract- including an ...


5

By API, what exactly do you mean? On many platforms you could link to a DLL or similar construction, but would having to be re-compiled for a particular native target (Intel/ARM) or endianness still qualify? A particular binary interface might still have difficulties with certain languages because of datatype issues or constructs (pointers trying to be ...


5

There's quite a few Javascript engines you can use. Which one makes most sense will largely depend on your specific platform/target environments/needs. There's the V8 javascript engine that powers Chrome, and Firefox's SpiderMonkey. If Windows-only would suffice, you can use Active Scripting (IActiveScript site and other interfaces). A number of my ...


4

From gtkmm's documentation: gtkmm was originally named gtk-- because GTK+ already has a + in the name. However, as -- is not easily indexed by search engines the package generally went by the name gtkmm, and that's what we stuck with.


4

Dynamic binding is another name for Late Binding. That's where the language ties a data element or method to an object after compilation time. Wikipedia equates dynamic & late binding: Dynamic binding (computing), also known as late binding links to http://en.wikipedia.org/wiki/Dynamic_binding_(computing) Javascript was my first exposure to ...


4

Are they both initializing the same child(?) variable? When the object is created, all the non-private properties of all parent classes belong to this newly created object. He doesn't know which properties belong to class it was created with, and which ones belong to a parent one. Can the child and parent have different values at the same time, perhaps ...


3

DrRacket maintains a list of keywords that it understands for auto-indentation, which you can find in the Preferences (under Editing->Indenting). If an identifier is listed as a keyword for indentation, then DrRacket will also highlight it differently if the chosen color scheme differentiates keywords from plain identifiers. Identifiers like + are not ...


3

Both of the other answers look excellent to me. I would add the following: the state of a scheme program is... a scheme program! That is, you can define a "meaning" function for scheme programs by showing how programs reduce to other programs. This is called a "small-step" semantics. To show you what I mean: what are the "steps"--in a seventh grade sense--...


3

Should I just dispense with the binding source and work with the DataTable object directly That at least will basically solve your whole problem. Use your UI labels for displaying things only, not for providing input values for further calculations. What would you do, for example, if you get a requirement to change the formatting of the cost label, to, ...


3

The quoted definitions of "entity" and "object" is ambiguous, we need to be more precise. A name is associated with a storage location which in turn contains a value. The value is the data. (I find it a bit odd to say the value could also be "code", but perhaps it refers to if the value is a function, which is possible.) Scoping is how names are associated ...


3

Dynamic dispatch in C++, Java, and C# is done via tables — that map a slot position or index to a function pointer — rather than by name.  Names are resolved at compile time, and they are assigned slots in tables as needed.  In your case, virtual b introduces a virtual method, which allocates a new slot in what's called the vtable (...


3

There are several types of binding and "late binding" may refer to several different things, depending on the technology and the context. It may be helpful to avoid the word "late" (and its opposite, early binding) and focus on specific types of bindings. Compile-time binding means that a symbol or entry point is bound to a specific address when the code is ...


2

The example once again from Robert Sebesta's Concepts of Programming Languages 9th edition: highs = [74, 84, 86, 90, 71]; This Javascript array is only brought into being when its assigned values. It then gets placed in the heap as a collection of those values. It would bind those values to that variable. It would not necessarily tell you what type they ...


2

cheat sheet of keyboard shortcuts This stuff is definitely only going to come with practice. If you have to look at a cheat sheet every time you need to look up a shortcut, you'll never remember it. You have to use it lots, if you do it enough, you'll probably end up practically forgetting exactly what the shortcut is, and just do it automatically, much ...


2

I have also tried the 'just use vi and don't touch the mouse' method but that only helps me with navigating code and not editing. This is the most effective method. If this method only helped you with navigating code, then you must not have tried it for long enough or for enough tasks. Instead of highlighting a line with the mouse, use Home, Shift+End ...


2

To add to above answers that suggest using an RPC mechanism. You could use Apache Thrift.(http://thrift.apache.org/). It is basically a RPC framework. As per the Thrift wiki: The Apache Thrift software framework, for scalable cross-language services development, combines a software stack with a code generation engine to build services that work ...


2

State and meaning are two very different things, and your question sort of conflates them. To the question "What does this Scheme program mean?", one can look at a semantics, either an informal one (a specification written in English, say), or a formal one (usually an operational semantics, but occasionally a denotational semantics, etc.). However, the ...


2

I'm not aware of any formal definition, but I can speculate a bit. Basically you can represent any program with a lambda expression in lambda calculus. A binary tree is a simpler view introduced by creators of Scheme, to give a nice idea to newbies in computer science. Lambda calculus explicitly defines operational semantics for evaluation of lambda ...


2

I've worked on and continue to work on large scale api projects and I've never used the BindAttribute. I would say with this code remove it completely, it will still work and it will remove the error prone strings in the attribute. Personally and from my experiences you shouldn't pass out your data entities from an api endpoint. We use view models, but ...


2

To restate your concern, you have a piece of software, the game engine, that supports a particular scripting language, Lua, but are unsure how to expose, access, and interject game objects and events to Lua, or to do the same with your own custom external driver (a C++ based editor). The game engine itself probably has a set of methods or decorators for ...


2

There are two major axes when interfacing with another language: the concepts that the interface can carry over: just values? references? generics? how the interface is implemented in "binaries" (called ABI) C has an advantage over C++ on those two fronts: C only has mostly simple concepts, which appear in most every other language1 The ABI of C binaries ...


1

Normally, a single-selection listbox offers a list-of-values interface for setting up, and a single-value interface for querying its state. You give it a list of values to present, and it tells you which one of them is selected. (Regardless of whether it is always-open or drop-down.) It is the same as a group-of-radio buttons: only one of the radio buttons ...


Only top voted, non community-wiki answers of a minimum length are eligible