Hmmm. This might be useful…. https://stackoverflow.com/questions/44246862/call-c-variadic-function-from-swift
It seems to me the va_list approach might work. Not sure because I haven’t looked too deeply into it myself so I could be wrong. :) But it would seem a severely limiting factor if there was NO way to do it. GC On Mon, Jul 31, 2023 at 02:29 <[email protected]> wrote: > 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]> 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. >> > > > -- Gregory Casamento GNUstep Lead Developer / OLC, Principal Consultant http://www.gnustep.org - http://heronsperch.blogspot.com https://www.patreon.com/bePatron?u=352392 - Become a Patron https://www.openhub.net/languages/objective_c - OpenHub standings
