# Artistic Style Developer Information

Artistic Style has compile options for creating a shared library (DLL) or static library for use with a Graphical User Interface (GUI). The shared library can be called from a C++, Objective‑C, C#, or Python program. There are also compile options for a Java Native Interface (JNI) that allows it to be called from a Java program. Information on compiling the various configurations of Artistic Style is in the Install Information.

The following Examples show how to call the Artistic Style shared library using the various programming languages. They are command line programs and do NOT contain a Graphical User Interface for the Artistic Style options.

Source code, documentation, and test files for all examples can be downloaded below or obtained from the source code repositories. These projects also require the source from Artistic Style in addition to the development examples.

### Examples

Source code from the following examples can be copied and pasted into an editor or development environment for compiling and running. Or the source code can be downloaded from the "Source Code Downloads" section below. The code highlighting for the example html pages was done with Highlight. The examples were formatted with Artistic Style using the Horstmann style.

Calling Artistic Style from a C++ Program contains information on calling Artistic Style as a shared or static library from a C++ program. It includes a C++ sample program that can be used to test the Artistic Style libraries.

Calling Artistic Style from an Objective-C Program contains information on calling Artistic Style as a shared or static library from an Objective-C program. It includes an Objective-C sample program that can be used to test the Artistic Style shared libraries.

Objective‑C on Windows and Linux contains information on compiling and running Objective-C programs using GNUstep. It has instructions for compiling the Example program on Windows or Linux.

Calling Artistic Style as a Java Native Interface contains information on calling Artistic Style as a shared library from a Java program using the Java Native Interface (JNI). It includes a Java sample program that can be used to test the shared library. The Java Development Kit (JDK) must be installed to compile Artistic Style.

Calling Artistic Style from a C# Program contains information on calling Artistic Style as a shared library from a C# program. It includes a C# sample program that can be used to test the shared library.

Calling Artistic Style from a C# Program Using Explicit Linking contains information on calling Artistic Style as a shared library from a C# program. It uses explicit linking to do a dynamic load of the shared library. It includes a C# sample program that can be used to test the shared library.

With explicit linking the shared library name can be changed at runtime, allowing the C# program to load either an x86 or x64 bit shared library. This provides the capability to make the program run on "Any CPU". The shared object can also be loaded from any directory, not just the directories searched by the system.

Calling Artistic Style from a Python Script contains information on calling Artistic Style as a shared library from a Python script. It includes a sample Python script that can be used to test the shared library.

### Source Code Downloads (old examples)

The downloads contain the above example source files and the test data. The test data is the same for all downloads.

#### C++ Example

The example for C++ contains the methods to call Artistic Style from a static or shared library using a C++ program. Compile Artistic Style as a static or shared library using the macro ASTYLE_LIB. Copy the shared library to the same folder as the C++ Example executable. Compile Example.cpp as an executable and link it to the library. It will format files in the test‑data directory included in the download.

#### Objective‑C Example

The example for Objective‑C contains the methods to call Artistic Style from a static or shared library using an Objective‑C program. Compile Artistic Style as a static or shared library using the macro ASTYLE_LIB. Copy the shared library to the same folder as the Objective‑C Example executable. It will format files in the test‑data directory included in the download.

#### Java Example

The example for Java includes an AStyleInterface class that calls the shared library using the Java Native Interface (JNI). Artistic Style must be compiled as a shared library using the macro ASTYLE_JNI. Copy the shared library to the same folder as the Java class files (it is loaded from the classpath directory). It will format files in the test‑data directory included in the download.

#### C# Example

This example for C# includes an AStyleInterface class that calls the shared library using a C# program. Compile Artistic Style as a shared library using the macro ASTYLE_LIB. Copy the shared library to the same folder as the C# class files (C# does a Windows type search for the shared library, looking first in the startup program's directory). It will format files in the test‑data directory included in the download.

#### C# Example Using Explicit Linking

This example for C# includes an AStyleInterface class that calls the shared library using a C# program. It uses explicit linking to do a dynamic load of the shared library. Compile Artistic Style as a shared library using the macro ASTYLE_LIB. Copy the shared library to the same folder as the C# class files. It will format files in the test‑data directory included in the download.

#### Python Examples

This download contains three Python scripts. The script ExampleExe.py calls an Artistic Style executable to format C++ source code. The scripts ExampleByte.py and ExampleUnicode.py call the Artistic Style shared library. The executable and shared library must be compiled using the macro ASTYLE_LIB. Copy the executable and shared library to the same folder as the Python scripts. They will format files in the test‑data directory included in the download.