From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: paul Newsgroups: gmane.lisp.guile.user Subject: Re: Difficulty integrating with Swift/Objective-C Date: Sun, 05 Sep 2021 19:35:51 +1000 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13224"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.4.15; emacs 27.2 To: Taylan Kammer , guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Sun Sep 05 11:36:28 2021 Return-path: Envelope-to: guile-user@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mMoZf-0003Df-7A for guile-user@m.gmane-mx.org; Sun, 05 Sep 2021 11:36:27 +0200 Original-Received: from localhost ([::1]:34704 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mMoZe-0002jW-2y for guile-user@m.gmane-mx.org; Sun, 05 Sep 2021 05:36:26 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40220) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mMoZU-0002jM-IF for guile-user@gnu.org; Sun, 05 Sep 2021 05:36:16 -0400 Original-Received: from aibo.runbox.com ([91.220.196.211]:46728) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mMoZR-00065J-EL for guile-user@gnu.org; Sun, 05 Sep 2021 05:36:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=inktvis.org ; s=selector1; h=Content-Transfer-Encoding:Content-Type:MIME-Version: Message-ID:Date:In-reply-to:Subject:To:From:References; bh=JJ+gSuKaz514h8fc2Q9v600GWI2YgQW1Oq3So8Pescs=; b=opfL2q6h1U11Q+QiWEXs53U6Us wXXs5yRvy7HfjYTY/5InNpVuyWZg+0Tc2wa+Yk8WZCiR6Ank0IVgcGD2m5qYQQRdZDhtaaxl5JlHy lIH+fI4UgXIwswIKDe8rUcDhb+rTHBBb301LTTbkygpU7ALnMPOzT/tTYKRZwDWtiA4tSmO2YBfbs NSJD2Zb2i1wrv5ssdIpAMGyuxP7QBCGZJaXPU50S120sW8lbE9IcZULJPupNXCCQLofqyF+sMGFq8 +SeV0u8YCAZEP9MpvO0p0+CHDHST9Vqb3NtV7VVmxJ34Tdkq6d3JY8eRDJ3PzNdVRBOnfGK2a0lW8 p7muNKJg==; Original-Received: from [10.9.9.73] (helo=submission02.runbox) by mailtransmit02.runbox with esmtp (Exim 4.86_2) (envelope-from ) id 1mMoZN-0007XV-KV; Sun, 05 Sep 2021 11:36:09 +0200 Original-Received: by submission02.runbox with esmtpsa [Authenticated ID (826552)] (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) id 1mMoZA-0001WM-6n; Sun, 05 Sep 2021 11:35:56 +0200 In-reply-to: Received-SPF: pass client-ip=91.220.196.211; envelope-from=paul@inktvis.org; helo=aibo.runbox.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.io gmane.lisp.guile.user:17714 Archived-At: Hey Taylan, Thank you for your reply! On 2021-09-05 at 18:26 AEST, quoth Taylan Kammer=20 : > To narrow down the issue, I'd attempt a few things, in order: > > 1. Compile only the C code, adding a main() function, just to=20 > make sure the OS > and the chosen Guile version and such are working fine with=20 > each other. > > 2. Compile pure Objective-C code, calling that run_guile()=20 > function firstly > directly from the main() function in main.m of the=20 > Objective-C program, and > commenting out the NSApplicationMain() call that would=20 > initialize Apple's > application framework. > > 3. See if reactivating the NSApplicationMain() call causes=20 > problems. (It should > be called *after* the Guile initialization.) > > 4. See if you can use Guile's C functions from=20 > -applicationDidFinishLaunching: > e.g. by doing: scm_c_eval_string("(begin (display=20 > 'HelloWorld) (newline))") > > If that works, we now have an Objective-C + Guile application,=20 > and want to move > to using Swift instead. This is where my Apple knowledge hits=20 > its limits because > I never used Swift. :-) > > But I guess Swift should have something equivalent to the main()=20 > function of C and > Objective-C, and calling Guile initialization from there might=20 > do the trick. > > If you hit a problem in step 3 or 4, then it could mean that=20 > Guile and Cocoa are > somehow incompatible as they both want to apply some magic to=20 > the C program while > initializing themselves. I wouldn't know how to approach that=20 > issue. Actually, in my case there is no Objective-C code, only Swift, but=20 these suggestions definitely give me some inspiration for things=20 to try. I'll see if i can figure out how the NSApplication is=20 bootstrapped so that i can hook in before that, because indeed,=20 the way i tried, i was attempting to initialise Guile from deep=20 within Application Kit code, which could be doomed to fail :). Anyway i am heading away from my computer now, but will definitely=20 give this angle a try =E2=80=94 thanks for taking the time to reply! Kind regards, p.