Language Interoperability is the ability of code to interact with code that is written using a different programming language. Language Interoperability can help maximize code reuse and, therefore, improve the efficiency of the development process.
Questions tagged [language-interoperability]
176 questions
3
votes
1 answer
Assign an array of Swift strings to a C structure variable taking a char ** value
I'm trying to interact with an old C terminal app/library from Swift. I've successfully integrated the source code and bridged the headers from C to Swift. The code compiles and runs, I can access all functions from C - library into swift.
There is…
![](../../users/profiles/9274898.webp)
George davies
- 43
- 3
3
votes
1 answer
What is a reliable way to find a Scala type's companion object via Java reflection?
I'm writing Java (not Scala) code, where I have a Java Class reference, referring to a Scala type T:
trait T {}
I would now like to discover the Java Class reference, and the singleton instance that corresponds to object T by using Java reflection…
![](../../users/profiles/521799.webp)
Lukas Eder
- 181,694
- 112
- 597
- 1,319
3
votes
1 answer
How do I deal with a pointer when Swift calls C API
The c Lib API : mycapi.h
typedef struct{
int itype;
double * dx;
double * dy;
}MyObjInfo;
typedef MyObjInfo * MyObjHandle;
MyObjHandle MyObjInit(const char *pFile);
add myapi.h as module
my swift code :
import Foundation
import…
![](../../users/profiles/5657390.webp)
Enping Wu
- 31
- 3
3
votes
1 answer
Can't get fortran function output from ctypes
I'm trying to call a Fortran function from Python using ctypes. I have tried to obtain the result from a subroutine and from a function (both with the same functionality), but I can't obtain the expected output from the function whereas the…
![](../../users/profiles/5362881.webp)
Jfreixa
- 71
- 6
3
votes
1 answer
ObjC generic collection with protocol as parameter is translated as [AnyObject]
Why protocols property is translated as [AnyObject] in swift, not as [P]
@protocol P;
@class C;
@interface TestGenerics: NSObject
@property NSArray* classes;
@property NSArray
* protocols; @end In Swift it look this way: public class…
![](../../users/profiles/2035054.webp)
Igor Palaguta
- 3,490
- 2
- 18
- 31
3
votes
1 answer
Fortran and c interoperability
I have been writing a Fortran and C interface, but there always appears errors. I'm not sure why there is the problem. The original C code is following:
#include
#include
#include
#include…
![](../../users/profiles/5111439.webp)
zmwang
- 341
- 1
- 4
- 13
3
votes
1 answer
Forced to define Go struct for casting an unsafe.Pointer() to a C struct
Interoperating with C code, I was not able to directly cast a structure and I was forced to define an equivalent one in Go.
The C function from libproc.h is
int proc_pidinfo(int pid, int flavor, uint64_t arg, void *buffer, int buffersize)
The C…
![](../../users/profiles/1035792.webp)
gsscoder
- 2,314
- 3
- 23
- 34
3
votes
1 answer
What's the best way of accessing a DRb object (e.g. Ruby Queue) from Scala (and Java)?
I have built a variety of little scripts using Ruby's very simple Queue class, and share the Queue between Ruby and JRuby processes using DRb. It would be nice to be able to access these from Scala (and maybe Java) using JRuby.
I've put together…
![](../../users/profiles/167435.webp)
Tom Morris
- 3,889
- 2
- 21
- 42
3
votes
2 answers
Why does Scala occasionally fall back to Java objects?
I'm almost certain that this question has been asked before, but I'm missing the right words to find it.
scala> Seq[Any]( 3, 3.4 )
res0: Seq[Any] = List(3, 3.4)
scala> res0( 1 ).getClass
res1: Class[_] = class java.lang.Double
scala> Seq( 3, 3.4…
![](../../users/profiles/1493269.webp)
Taig
- 6,172
- 4
- 37
- 63
3
votes
1 answer
Code organisation for native interoperability in .NET
I am currently porting some native code to C#, which consists of various structures, delegates, enumerations and external method calls.
Some of the fields within structures expect certain constants to be applied to them. It seems logical to list…
![](../../users/profiles/1033686.webp)
Matthew Layton
- 32,574
- 37
- 140
- 255
2
votes
2 answers
Calling scanf from Ada
How do you call scanf from Ada? That is, presumably with an appropriate pragma import declaration, but what would the declaration look like?
(I'm interested in how to call C functions of the more unruly variety from Ada, not how to parse strings per…
![](../../users/profiles/45843.webp)
rwallace
- 26,045
- 30
- 102
- 195
2
votes
0 answers
Using .NET Core 3.1 C# dll in C++ project
I'm a software developer in a generalist company. We are a small team and I inherit some 20 year old software (like in a lot of companies I guess)
This software is coded in C / C ++, with Visual Studio 2010. Its purpose is to communicate with…
![](../../users/profiles/15792858.webp)
JohanB
- 21
- 2
2
votes
1 answer
How to use map_indexing_suite from Boost.Python with custom not std object?
Simple example of 'map_indexing_suite' usage is working fine:
class_
![](../../users/profiles/4437603.webp)
Oleg Kmechak
- 123
- 10
2
votes
0 answers
How to use class from C# library in F# module?
I have 2 projects in a solution: a C# class library and an F# library.
The C# library has the following class:
using System;
namespace TestFSharpDataLayer.Domain
{
public class TestData
{
public Guid Id { get; set; }
public…
![](../../users/profiles/1502310.webp)
Léster
- 1,034
- 14
- 28
2
votes
1 answer
string array C# Interoperability to C++ dll; string array from C# to C++ dll which sets the data and sends it back to c#
this is what i have so far... basically I use the c++ dll to populate the tree components set them and then return them to the managed csharp code. I am running into problems and have tried the entire day with no success. All I want to accomplish…
![](../../users/profiles/707383.webp)
James Arthur
- 21
- 1