Skip to content

Commit 2b5d253

Browse files
linesightclaude
andcommitted
macos: fix extern C SubprocessMacInit declaration scope
extern "C" linkage specification must be at namespace (file) scope in C++, not inside a function body. Move the SubprocessMacInit() forward declaration out of main() into file scope, guarded by OS_MAC. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent e69f40a commit 2b5d253

1 file changed

Lines changed: 12 additions & 9 deletions

File tree

src/subprocess/main.cpp

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,21 @@ int APIENTRY wWinMain(HINSTANCE hInstance,
2828

2929
#include <string.h>
3030

31+
#if defined(OS_MAC)
32+
// CEF 130+: MachPortRendezvousClientMac builds the service name as
33+
// CFBundleIdentifier + ".MachPortRendezvousServer." + parent_pid
34+
// The browser process injects CFBundleIdentifier = "org.cefpython" in
35+
// MacInitialize() before CefInitialize(). This subprocess binary is a flat
36+
// binary (not an app bundle), so CFBundleGetMainBundle() returns no
37+
// CFBundleIdentifier, producing a lookup name starting with "." that never
38+
// matches the registered service. Call SubprocessMacInit() to inject the
39+
// same identifier so bootstrap_look_up finds the server.
40+
extern "C" void SubprocessMacInit();
41+
#endif
42+
3143
int main(int argc, char **argv)
3244
{
3345
#if defined(OS_MAC)
34-
// CEF 130+: MachPortRendezvousClientMac builds the service name as
35-
// CFBundleIdentifier + ".MachPortRendezvousServer." + parent_pid
36-
// The browser process injects CFBundleIdentifier = "org.cefpython" in
37-
// MacInitialize() before CefInitialize(). This subprocess binary is a flat
38-
// binary (not an app bundle), so CFBundleGetMainBundle() returns no
39-
// CFBundleIdentifier, producing a lookup name starting with "." that never
40-
// matches the registered service. Call SubprocessMacInit() to inject the
41-
// same identifier so bootstrap_look_up finds the server.
42-
extern "C" void SubprocessMacInit();
4346
SubprocessMacInit();
4447
#endif
4548
#if defined(OS_LINUX)

0 commit comments

Comments
 (0)