I meant to say while I can call a function like objc_getClass("NSWindow") or 
sel_getUid(""), I cannot call objc_msgSend(id, SEL, …) because Swift cannot 
import variadic C functions.

> On Jul 31, 2023, at 12:32 AM, [email protected] wrote:
> 
> 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 <[email protected]> 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 <[email protected] <mailto:[email protected]>> 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