discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bridge from Swift to Objective-C (GNUStep Runtime) via C or other me


From: dr_clow
Subject: Re: Bridge from Swift to Objective-C (GNUStep Runtime) via C or other method
Date: Mon, 31 Jul 2023 00:32:37 -0500

I built a Swift module that imports libobjc2's headers and links against the library. So far, I got it to link against AppKit as well. The first problem that I ran into, for which I am currently unaware of a solution, is that almost all the objc functions use variadic arguments which do not import into Swift. 

While I can call a function like objc_msgSend(id, SEL, …), I'm unable to because it's not supported in swift. Are there any solutions using only C imported into Swift that would allow me to call these method? 

The suggestion is to use version of the functions that use va_lists instead, but obviously those versions are not present in the library. 

- Austin

On Jul 29, 2023, at 4:28 PM, Stefan Bidigaray <stefanbidi@gmail.com> wrote:

You can have a look at the code in libs-corebase for an example on how to call method from C code. All the bridge code is in Source/GSObjCRuntime.h.

On Sat, Jul 29, 2023, 16:05 <dr_clow@me.com> wrote:
I am very interested in building a bridge between Swift and GNUStep's Objective-C Runtime.

Given that the Objective-C implementation provided by GNUStep doesn't interact directly with Swift as Swift can with Apple's Objective-C runtime, I was wondering if there was a way to call into GNUStep from C. If someone could show me an example of a way to call into GNUStep using either C as a bride though a Swift project or directly from Swift, I would be more than willing to start building a bridge. I just don't currently understand how to do it.

I malignly want to do this so I could more rapidly build software for OnFlapp's GNUStep Desktop, but I think this would ultimately benefit everyone.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]