# External Object Examples

Examples of external objects for Pd.

Here are the sources for a few simple external objects in Pd, along with patches
to test them.  There is a makefile included that should help compile them
using the "make" (Mac or Linux) or "nmake" (Windows) shell commands.

This relies on having installed a development environment for whatever computer
is in use.  For Windows, this should be Microsoft Visual C (it's also possible
to compile externs using MinGW but this makefile doesn't support that).

To compile, type "make pd_linux", "nmake pd_nt" (for Windows), or
"make pd_darwin" (for macOS).

If you have saved these files to a new location (other than the Pd distribution
itself), it will probably be necessary to customize the makefile by changing the
definition of "PDNTINCLUDE" (Windows) or "LINUXINCLUDE" (Linux or Mac)
to point back to the PD source directory.

## macOS

On macOS, the compiler will build for the current architecture by default. If
you want to build for non-native or multi-architectures, pass then via CFLAGS:

    # for Intel 32- & 64-bit
    make pd_darwin CFLAGS="-arch i386 -arch x86_64"

    # for Arm M1 + Intel 64-bit
    make pd_darwin CFLAGS="-arch arm64 -arch x86_64"

To check the architecture(s) in a built external, use the `file` command:

    file obj*.pd_darwin

Note: available architectures are dependent upon the macOS SDK version. For
instance, starting with macOS 10.15, i386 is no longer available.

## Windows

Windows users will most likely have to update the makefile to point correctly to
the current version of Microsoft Visual C.
