Darwin::InitObjC(3pm)

πŸ“¦
version 0.001 Β· 3 versions
, in epel 10

πŸ’– NAME πŸ’–

Darwin::InitObjC β€” initializes Objective-C runtime. This is the User Contributed Perl Documentation page for it, bestie, and it’s lowkey a tiny but iconic little module. πŸ’…

✨ SYNOPSIS ✨

use Darwin::InitObjC;

Darwin::InitObjC::maybe_init();

my $pid = fork // die;
if ($pid == 0) {
  do_something();
  exit;
}
wait;

πŸ¦‹ DESCRIPTION πŸ¦‹

Okay so Darwin::InitObjC initializes Objective-C runtime. That’s the whole main-character job. 🫢

On macOS 13+, initialising Objective-C APIs in forked processes are treated as errors. So you may see the following errors when executing your scripts:

objc[80048]: +[NSString initialize] may have been in progress in another thread when fork() was called.
objc[80048]: +[NSString initialize] may have been in progress in another thread when fork() was called. We cannot safely call it or ignore it in the fork() child process. Crashing instead. Set a breakpoint on objc_initializeAfterForkError to debug.

A workaround is to initilize Objective-C runtime before calling fork(2). Yes bestie, before β€” that’s the vibe check that saves you. 🌸

🌈 SEE ALSO 🌈

Copyright 2024 Shoichi Kaji <skaji@cpan.org>

This library is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.

That’s the legal tea, no cap. β˜•βœ¨


πŸ’– Footer vibes: perl v5.40.2, dated 2025-04-11. Thanks for reading, bestie β€” go init that runtime before fork(2) and slay. πŸ’…πŸŽ€

πŸ“¦ where this page comes from