unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: paul <paul@inktvis.org>
To: Taylan Kammer <taylan.kammer@gmail.com>, guile-user@gnu.org
Subject: Re: Difficulty integrating with Swift/Objective-C
Date: Sun, 05 Sep 2021 19:35:51 +1000	[thread overview]
Message-ID: <m2pmtnmkjs.fsf@inktvis.org> (raw)
In-Reply-To: <f72978b4-1ea4-8a7e-2199-f7608b9e9ac0@gmail.com>

Hey Taylan,

Thank you for your reply!

On 2021-09-05 at 18:26 AEST, quoth Taylan Kammer 
<taylan.kammer@gmail.com>:
> 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 
> make sure the OS
>    and the chosen Guile version and such are working fine with 
>    each other.
>
> 2. Compile pure Objective-C code, calling that run_guile() 
> function firstly
>    directly from the main() function in main.m of the 
>    Objective-C program, and
>    commenting out the NSApplicationMain() call that would 
>    initialize Apple's
>    application framework.
>
> 3. See if reactivating the NSApplicationMain() call causes 
> problems.  (It should
>    be called *after* the Guile initialization.)
>
> 4. See if you can use Guile's C functions from 
> -applicationDidFinishLaunching:
>    e.g. by doing: scm_c_eval_string("(begin (display 
>    'HelloWorld) (newline))")
>
> If that works, we now have an Objective-C + Guile application, 
> and want to move
> to using Swift instead.  This is where my Apple knowledge hits 
> its limits because
> I never used Swift. :-)
>
> But I guess Swift should have something equivalent to the main() 
> function of C and
> Objective-C, and calling Guile initialization from there might 
> do the trick.
>
> If you hit a problem in step 3 or 4, then it could mean that 
> Guile and Cocoa are
> somehow incompatible as they both want to apply some magic to 
> the C program while
> initializing themselves.  I wouldn't know how to approach that 
> issue.

Actually, in my case there is no Objective-C code, only Swift, but 
these suggestions definitely give me some inspiration for things 
to try.  I'll see if i can figure out how the NSApplication is 
bootstrapped so that i can hook in before that, because indeed, 
the way i tried, i was attempting to initialise Guile from deep 
within Application Kit code, which could be doomed to fail :).

Anyway i am heading away from my computer now, but will definitely 
give this angle a try — thanks for taking the time to reply!

Kind regards,
p.



  reply	other threads:[~2021-09-05  9:35 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-05  6:03 Difficulty integrating with Swift/Objective-C paul
2021-09-05  8:26 ` Taylan Kammer
2021-09-05  9:35   ` paul [this message]
2021-09-06 10:21   ` paul
2021-09-06 13:11     ` Taylan Kammer
2021-09-05 10:56 ` Chris Vine
2021-09-06 10:26   ` paul
2021-09-06 16:28     ` Chris Vine
2021-09-08 23:59 ` paul
2021-09-28 20:22   ` Aleix Conchillo Flaqué

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2pmtnmkjs.fsf@inktvis.org \
    --to=paul@inktvis.org \
    --cc=guile-user@gnu.org \
    --cc=taylan.kammer@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).