Questions tagged [cross-language]

In programming, "cross-language" or "multi-language" refers to features that operate across multiple programming languages.

In programming, "cross-language" or "multi-language" refers to features that operate across multiple programming languages.

Cross-language features include type systems, data formats, storage layouts, etc. which are common across multiple languages. They help applications or services written in different languages to inter-operate and exchange information.

132 questions
93
votes
4 answers

"if" statement syntax differences between C and C++

if (1) int a = 2; This line of code is valid C++ code (it compiles at the very least) yet invalid C code (doesn't compile). I know there are differences between the languages but this one was unexpected. I always thought the grammar was if (expr)…
Tom Hickson
  • 1,095
  • 7
  • 12
44
votes
4 answers

Instantiating a python class in C#

I've written a class in python that I want to wrap into a .net assembly via IronPython and instantiate in a C# application. I've migrated the class to IronPython, created a library assembly and referenced it. Now, how do I actually get an instance…
Yes - that Jake.
  • 16,725
  • 14
  • 70
  • 96
41
votes
5 answers

Why is C++'s NULL typically an integer literal rather than a pointer like in C?

I've been writing C++ for many years, using nullptr for null pointers. I also know C, whence NULL originates, and remember that it's the constant for a null pointer, with type void *. For reasons, I've had to use NULL in my C++ code for something.…
einpoklum
  • 118,144
  • 57
  • 340
  • 684
20
votes
3 answers

C++ alternative to perror()

I know we can use perror() in C to print errors. I was just wondering if there is a C++ alternative to this, or whether I have to include this (and therefore stdio.h) in my program. I am trying to avoid as many C functions as possible.
Sagar
  • 9,456
  • 6
  • 54
  • 96
18
votes
7 answers

Why does the Python/C API crash on PyRun_SimpleFile?

I've been experimenting with embedding different scripting languages in a C++ application, currently I'm trying Stackless Python 3.1. I've tried several tutorials and examples, what few I can find, to try and run a simple script from an…
Sion Sheevok
  • 4,057
  • 2
  • 21
  • 37
17
votes
7 answers

How to share business concepts across different programming languages?

We develop a distributed system built from components implemented in different programming languages (C++, C# and Python) and communicating one with another across a network. All the components in the system operate with the same business concepts…
Lev
  • 727
  • 5
  • 17
13
votes
1 answer

Declare a C++ function that has C calling convention but internal linkage

I'm trying to interface with a C library, which expects me to provide a pointer to a callback function. As I understand it, according to the standard the callback must have C language linkage, due to possibly different calling convention. I can…
yuri kilochek
  • 12,709
  • 2
  • 32
  • 59
9
votes
2 answers

How to unserialize PHP Serialized array/variable/class and return suitable object in C#

The goal is to unserialize a PHP serialized string and get sutable object in C# Is there any way to make this possible in C#(.Net)? To be more specific: We need to make an application which comunicates (Via HTTP) to specific website which returns…
George
  • 1,466
  • 3
  • 12
  • 30
8
votes
3 answers

Wrapping C create and destroy functions using a smart pointer

I have some C API that handles object creation and destruction, it provides: createObject(...) and destroy(...). I want to wrap it into some more modern construction/destruction mechanisms and use them with smart pointers. I am afraid that at some…
Piotr Barejko
  • 608
  • 4
  • 15
8
votes
4 answers

Can you call Ada functions from C++?

I'm a complete Ada newbie, though I've used Pascal for 2-3 years during HS. IIRC, it is possible to call Pascal compiled functions from C/C++. Is it possible to call procedures & functions written in Ada from C++?
oz10
  • 153,307
  • 27
  • 93
  • 128
8
votes
4 answers

Interacting with java code from C#

We've written a Java program which we are looking to use and interact with from C#. What are our options? Optimally it would be possible to compile the Java application as a library (.DLL) that we could reference from C# perhaps using P/Invoke.…
Kasper Holdum
  • 12,993
  • 6
  • 45
  • 74
8
votes
2 answers

In Apache Thrift How Should Date Objects Be Represented

In the Thrift IDL there isn't a Date type. What's the best cross language mechanism to represent a date object. I think there are 2 ideal candidates but I'd love to hear other ideas. String - in each language you could use something like strftime…
Bryan M
  • 183
  • 1
  • 6
7
votes
1 answer

How to pass a list of objects from C++ to C#?

My first question here :) I am working with an application written in C++ (a map editor for a game) that has the front end UI written in C#. Since i'm new to C# i'm trying to do as much as possible on the C++ side. From C# i want to call a C++…
Cousken
  • 180
  • 2
  • 10
7
votes
1 answer

ImportError when calling a Julia module function from PyJulia

I'm trying to include a Julia function (PowerModelsDistribution.solve_mc_opf) in some Python code. The package works in Julia but I'm getting stuck on including it with PyJulia. I've tried a few things: 1. from julia import…
apigott
  • 73
  • 2
7
votes
4 answers

Is there a cross-language TDD solution?

I want to write a simple colour management framework in C#, Java and AS3. I only want to write the unit tests once though, rather than recreating the unit tests in JUnit, FlexUnit and say NUnit. I have in mind the idea of say an xml file that…
David Arno
  • 42,717
  • 16
  • 86
  • 131
1
2 3
8 9