darlinghq / darling

Darwin/macOS emulation layer for Linux
http://www.darlinghq.org
GNU General Public License v3.0
11.57k stars 448 forks source link

Getting Simple wxWidgets programs to work (requires NSRunningApplication/NSAppleEventManager) #758

Open Arucard1983 opened 4 years ago

Arucard1983 commented 4 years ago

In order to avoid a sequence of issues reports, although some bugs was fixed recently, I notice that my research software that use wxWidgets when running on Darling will display the same errors. This cross-platform framework bridges C++ code to the native operating system API, creating an universal wrapper to make work on several operating systems.

All sample programs appear to be started, but still fail to execute due to the following error: Stub called: currentApplication in NSRunningApplication Segmentation fault: 11

The source code (that requires to build wxWidgets with Xcode SDK before compile the program) are available from: https://docs.wxwidgets.org/stable/overview_helloworld.html

My research program also displays the following unimplemented stub: 2020-04-16 22:05:00.307 ERYA-Bulk-OSX[54:3e8] Stub called: setEventHandler:andSelector:forEventClass:andEventID: in NSAppleEventManager

Arucard1983 commented 4 years ago

It appears that those functions are always called by every wxWidgets program using Cocoa backend.

The following source code file contains all functions needed: https://github.com/wxWidgets/wxWidgets/blob/ed8fd1893a2c53ca4fdde763c59ba5a9c2d3ba1e/src/osx/cocoa/utils.mm

Arucard1983 commented 4 years ago

It require to implement the NSAppleEventManager that was only stubbed by the commit: https://github.com/darlinghq/darling/commit/39ca28a6235b2e214a4dc2b426296acc4d912020

And the NSRunningApplication proper implementation which is only a stub: https://github.com/darlinghq/darling-cocotron/blob/master/AppKit/NSRunningApplication.m