wxWidgets / wxWidgets

Cross-Platform C++ GUI Library
https://www.wxwidgets.org/
5.74k stars 1.69k forks source link

Mach-O shared library menu prob #5368

Closed wxtrac closed 2 years ago

wxtrac commented 22 years ago

Issue migrated from trac ticket # 5368

component: old wxOSX/Carbon port | priority: normal

2002-04-22 02:14:04: @kollivier created the issue


When running wxMac as a Mach-O shared library (.dylib) under Mac OS X, the resource fork is empty and not loaded properly. Since the resource fork is not loaded, attempts to create a wxMenuBar fail. The patch enables wxMac to load the resource fork when creating a menubar. Please review this code, it is my first patch to wxWindows. =)

Also, note that for this code to work the build instructions or makefile will need to be changed so that the compiled resource file is copied into the resource fork of the Mach-O shared library. This can be done with the cp command like so:

cp libwx_mac-2.3.dylib.2.0.0/rsrc libwx_mac- 2.3.rsrc

wxtrac commented 22 years ago

2002-04-22 02:14:04: @kollivier uploaded file resfork.patch (2.0 KiB)

Patch file for /src/mac/menu.cpp

wxtrac commented 22 years ago

2002-04-25 22:17:56: depeyrot (Gilles Depeyrot) commented


The wxMac resource fork is empty because the resources are currently added to the applications that are created with wxMac. This is not a good solution long term as the resources belong to the library.

Adding the resources to the library is one solution, however it becomes difficult to manipulate the resulting library since Unix command line tools will ignore the resource fork.

What about about creating a framework to hold the shared library along with the resources?

wxtrac commented 22 years ago

2002-04-26 05:42:53: @kollivier commented


I thought about a framework but I saw some messages on the wxDev list about problems building wxMac as a framework. Here's an example:

http://lists.wxwindows.org/pipermail/wx-dev/2002- March/018792.html

I was hoping to add a quicker fix to make it so that people could build wxPython "out of the box". Without this code, wxPython will not load its menus. However, as a temporary fix, we could tell people to apply the patch for now.

I think it is also possible to make the shared library into a CFM Bundle, but I don't yet know much about how that would work, or what the advantages/disadvantages of that would be. Do you think this is an option?

wxtrac commented 22 years ago

2002-04-26 07:51:25: depeyrot (Gilles Depeyrot) commented


The messages on building a framework were all Project Builder related and about not being able to build a full fledged framework (with wx headers).

I think it should be possible to create a framework using the command line builds (maybe without including the headers in the FrameWork itself).

I suppose the CFM bundle is not an option because the library is Mach-O, but I am not sure. In any case, a framework is a bundle (just a specific type of bundle).

I haven't yet looked at creating a framework for the library, but I have added application bundle building for the samples.

wxtrac commented 22 years ago

2002-05-03 21:09:25: depeyrot (Gilles Depeyrot) commented


I applied a slightly different solution reading the resources from an external file next to the shared library.