OS Manuals

Darwin::InitObjC(3pm)

Darwin::InitObjC - initializes Objective-C runtime

Darwin::InitObjC(3pm) User Contributed Perl Documentation Darwin::InitObjC(3pm)

Darwin::InitObjC - initializes Objective-C runtime

  use Darwin::InitObjC;
  Darwin::InitObjC::maybe_init();
  my $pid = fork // die;
  if ($pid == 0) {
    do_something();
    exit;
  }
  wait;

Darwin::InitObjC initializes Objective-C runtime.

In 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).

https://bugs.ruby-lang.org/issues/14009

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.

2026-09-10 perl v5.44.0

perl-darwin-initobjc 0.001-r5 · os · ingested 2026-09-30