Darling Wiki

macOS translation layer for Linux

User Tools

Site Tools


This is an old revision of the document!

Generating Stubs

Darling has a stub generator that is capable of generating stubs for C and Objective-C frameworks and shared libraries. A computer running macOS is required to run the stub generator.

Getting dependencies

  1. Download class-dump from here. This is where the build of class-dump for use with the stub generator is available from.
  2. Make a directory with the name “bin” in your home folder.
  3. Place place the class-dump binary you downloaded in ~/bin

The stub generator assumes class-dump is located at ~/bin/class-dump

Getting the stub generator

Copy/paste the following command into Terminal.

curl https://raw.githubusercontent.com/darlinghq/darling/master/tools/darling-stub-gen -o ~/bin/darling-stub-gen && chmod +x ~/bin/darling-stub-gen && echo "export PATH=\"~/bin:\$PATH\"" >> ~/.bash_profile && source ~/.bash_profile

Using the stub generator

To run the stub generator, structure your arguments like this:

darling-stub-gen /System/Library/Frameworks/DVDPlayback.framework/DVDPlayback DVDPlayback

The process is identical for dynamic libraries.

The above command will create a folder that can be placed in the /src directory of Darling's source tree. It is generated from the DVDPlayback framework. Note that the first argument points to the actual binary of the framework, not the root directory of the framework.

Once you have generated a stub source folder for the framework as the above command does for DVDPlayback, you can copy that folder into Darling's source tree under /src and submit a pull request containing your contribution.

generating_stubs.1558827768.txt.gz · Last modified: 2019/05/25 23:42 by ahyattdev