Questions tagged [language-interoperability]

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.

193 questions
1
vote
1 answer

How to use file descriptor to divert write-to-file in swift?

I would like to use some C code that uses a file descriptor. Background is that I would like to read some data from cgraph library. public extension UnsafeMutablePointer where Pointee == Agraph_t { func saveTo(fileName: String) { let f =…
Wizard of Kneup
  • 1,863
  • 1
  • 18
  • 35
1
vote
1 answer

Xamarin.iOS C# interoperability with objective-c: callbacks from objective-c to non-static C# methods

I'm an objective-c novice, so please forgive what may be incorrect terminology. In Xamarin.iOS, I am successfully employing a C# class with multiple static methods to implement callback functionality from objective-C to C#. I'd like to avoid the…
1
vote
1 answer

Setting file path in imported C function inside Swift Framework

I am trying to use C library source files inside my Cocoa Framework which has function named void swe_set_ephe_path(char *path); Which will basically be swe_set_ephe_path(”C:\\SWEPH\\EPHE”); for windows. This library contains other data files…
John
  • 31
  • 5
1
vote
0 answers

Swift class subclassed from Objective-C lightweight generic class not visible from Objective-C code

I have an objective-c class @interface LightweightGenericHolder : NSObject @property (nonatomic, strong, readwrite) T value; @end I created swift subclass from it public class LightweightGenericHolderSubclass:…
minroff
  • 21
  • 1
  • 4
1
vote
1 answer

Python and C++ integration.Problems with dynamic library

I use Swig.(Mac os 10.13) My shell script: swig -c++ -python -o example_wrap.cpp example.i g++ -c -std=c++17 -fPIC example.cpp g++ -c -std=c++17 -fPIC example_wrap.cpp -o example_wrap.o…
1
vote
1 answer

Building a Python module from C code fails

I'm reading this tutorial on how to bind Python and C. I'm using Python v3.7.1 so I had to use the new Python interface (different from the example), so now I have: adder.c #include static PyObject *addList_add(PyObject *self, PyObject…
user3132457
  • 789
  • 2
  • 11
  • 29
1
vote
1 answer

Resolving Swift.h and Bridging-Header.h circular references involving enums

I have an Objective-C header that has to be used by a Swift class. However, this header has to use the Swift.h file for an enum declared in a Swift file. In other words, the setup is as follows: MPViewController.h #import…
peco
  • 1,411
  • 3
  • 17
  • 38
1
vote
4 answers

C# dll which is inter-operable with php and java

I need to create a dll in C sharp which is interoperable with php and Tomcat/Java webservices. Will the normal C# class library help me for this? Thanks, John
1
vote
0 answers

Interoperability with SwiftyChrono from Objective-C

I'm trying to use the SwiftyChrono swift library from an Objective-C project. Since it's using a struct instead of a class (amongst many other Swift only features), I'm unable to make it work. Given I am not in the position of moving all our…
1
vote
0 answers

How to make a C++ function that calls fortran function

Problem A: I need to make lots calls with slightly different input parameters to a Fortran function from C++. ! FORTRAN code subroutine myFortranFunction(a,b,c,d) integer, intent(in) :: a integer, optional intent(in) :: b character(len=*), optional,…
QuantumDot
  • 293
  • 1
  • 3
  • 10
1
vote
0 answers

How to more quickly import a long list of global symbols from Fortran dylib into C?

I am creating a C wrapper for an extensive Fortran library algorithms of which I am not the author. This Fortran library is made up of multiple modules each containing many global subroutines and variables. Although there are only a handful of user…
QuantumDot
  • 293
  • 1
  • 3
  • 10
1
vote
1 answer

Syntax for using multi-argument init for a swift class in Objective-C

I am a new iOS developer and am having a small problem initializing a Swift class in a separate objective C file within my project. I have already configured the project properly and imported the class as per answers to this question: Can't use…
Ben
  • 13
  • 5
1
vote
0 answers

Late binding call C# method with out parameters from unamanged c++

The goal is this: call methods of the .NET library from unamanged c++ using late binding without using COM and import tlb library. I have a trivial class written in c# (just for test) put in a class library (CSLib) compiled with framework 4.0…
Alessandro Ciurlo
  • 102
  • 1
  • 2
  • 11
1
vote
2 answers

Automatic interaction with Perl code

I was wondering is there is any way to interact with Perl 5 code automatically, without creating explicit APIs and publishing it over some protocol. I don't want to limit this question to any specific ways of achieving that - I'm looking for any…
viraptor
  • 33,322
  • 10
  • 107
  • 191
1
vote
2 answers

Attempting to pass a contiguous dynamic 2d array from C to Fortran

I understand that extra care needs to be taken when allocating memory in C to ensure a 2d array is contiguous, but I still don't get expected outcomes when I pass it to Fortran. Below is a toy version of my attempt: A main.c file which allocates…