Skip to content

Instantly share code, notes, and snippets.

@zacharycarter
Last active May 22, 2025 15:00
Show Gist options
  • Save zacharycarter/846869eb3423e20af04dea226b65c18f to your computer and use it in GitHub Desktop.
Save zacharycarter/846869eb3423e20af04dea226b65c18f to your computer and use it in GitHub Desktop.

Revisions

  1. zacharycarter revised this gist Feb 28, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion wclwn.md
    Original file line number Diff line number Diff line change
    @@ -261,7 +261,7 @@ Hint: operation successful (503 lines compiled; 0 sec total; 1.504MiB; ) [Succes
    ```
    This warning can be safely ignored. If you re-examine the include directory's contents you'll notice a new file present : soloud_c.nim

    Feel free to open this file and examine its contents. These are the auto-generated bindings [c2nim](#c2nim) has produced for us.
    I recommend opening this file and examining its contents. These are the auto-generated bindings [c2nim](#c2nim) has produced for us.

    ##### Binding compilation
    The last step involved in the generation of our bindings, is to actually compile them. To do so issue the following command :
  2. zacharycarter revised this gist Feb 28, 2017. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions wclwn.md
    Original file line number Diff line number Diff line change
    @@ -91,12 +91,12 @@ It can be extremely beneficial to examine existing tests | examples bundled with
    The <a href="http://sol.gfxile.net/soloud/" target="_blank">soloud</a> audio library bills itself as :
    > ... an easy to use, free, portable c/c++ audio engine for games
    This library was chosen as the first example, because it is a very straightforward project to generate bindings for. The library offers a <a href="http://sol.gfxile.net/soloud/c_api.html" target="_blank">C API</a> which is the API we will be binding to.
    This library was chosen as the first example, because it is a very straightforward process to generate bindings to it. The library offers a <a href="http://sol.gfxile.net/soloud/c_api.html" target="_blank">C API</a> which is the API we will be binding to.

    ### Clone Project
    The <a href="https://github.com/jarikomppa/soloud" target="_blank">soloud</a> project is available on github and can be cloned with the command :
    ```
    git clone https://github.com/jarikomppa/soloud.git
    $ git clone https://github.com/jarikomppa/soloud.git
    ```
    Perform this command in whatever directory you would like to use as your workspace for this tutorial. This command will create a new folder named 'soloud' and will checkout the soloud project into it.
    ### Explore Project
  3. zacharycarter revised this gist Feb 28, 2017. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions wclwn.md
    Original file line number Diff line number Diff line change
    @@ -308,6 +308,10 @@ Soloud_deinit(sl)
    Soloud_destroy(sl)
    ```
    To run the test issue the following command :
    ```
    $ nim c -r soloud_test.nim
    ```
    This test will play an .ogg file and quit after its duration.
    ___
    <i class="icon-desktop"></i>Nuklear
  4. zacharycarter revised this gist Feb 28, 2017. No changes.
  5. zacharycarter revised this gist Feb 28, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion wclwn.md
    Original file line number Diff line number Diff line change
    @@ -28,7 +28,7 @@ This guide is an attempt to empower readers to create their own bindings to othe
    >
    >The author of this guide spends most of his spare time developing video games, and tools used for building them. Therefore the focus of the libraries presented in this guide will be game development related.
    The libraries we will be creating to are :
    The libraries we will be creating bindings to are :
    #### <a class="icon-file" href="https://github.com/jarikomppa/soloud" target="_blank">Soloud : 3D Audio Engine</a>
    #### <a class="icon-file" href="https://github.com/vurtun/nuklear" target="_blank">Nuklear : Immediate Mode GUI Library</a>
    #### <a class="icon-file" href="https://bitbucket.org/cfyzium/bearlibterminal" target="_blank">Bearlib Terminal : Terminal emulator for Roguelike Games</a>
  6. zacharycarter revised this gist Feb 28, 2017. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion wclwn.md
    Original file line number Diff line number Diff line change
    @@ -23,11 +23,12 @@ Introduction

    One of the many wonderful features of the Nim programming language is its <a href="https://nim-lang.org/docs/backends.html#interfacing" target="_blank">interoperability with other programming languages</a> and <a href="https://nim-lang.org/docs/manual.html#foreign-function-interface" target="_blank">Foreign Function Interface</a>. Summarized, Nim code can call code written in other programming languages like C or JavaScript, and vice versa. This means that binding to libraries written in other programming languages, like C, is possible with Nim.

    This guide is an attempt to empower readers to create their own bindings to other libraries or code written in C. It will walk readers through a few examples demonstrating how bindings were created to some rather complex C libraries, and we'll also create brand new bindings to a C library which bindings don't yet exist for :
    This guide is an attempt to empower readers to create their own bindings to other libraries or code written in C. It will walk readers through a few examples demonstrating how bindings were created to some rather complex C libraries, and we'll also create brand new bindings to a C library which bindings don't yet exist for.
    >**Note:**
    >
    >The author of this guide spends most of his spare time developing video games, and tools used for building them. Therefore the focus of the libraries presented in this guide will be game development related.
    The libraries we will be creating to are :
    #### <a class="icon-file" href="https://github.com/jarikomppa/soloud" target="_blank">Soloud : 3D Audio Engine</a>
    #### <a class="icon-file" href="https://github.com/vurtun/nuklear" target="_blank">Nuklear : Immediate Mode GUI Library</a>
    #### <a class="icon-file" href="https://bitbucket.org/cfyzium/bearlibterminal" target="_blank">Bearlib Terminal : Terminal emulator for Roguelike Games</a>
  7. zacharycarter revised this gist Feb 28, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion wclwn.md
    Original file line number Diff line number Diff line change
    @@ -37,7 +37,7 @@ This guide is an attempt to empower readers to create their own bindings to othe
    >
    >This guide assumes the reader has a certain amount of familiarity with the C programming language as well as the Nim programming language, however it does not require the reader be an expert in either language.
    >Familiarity with development tooling such as <a href="https://git-scm.com/" target="_blank">git</a> or an equivalent source control management system is also assumed. Git | Mercurial will be used in all examples for cloning the projects we will be generating bindings to.
    >Familiarity with development tooling such as git or an equivalent source control management system is also assumed. <a href="https://git-scm.com/" target="_blank">Git</a> and <a href="https://www.mercurial-scm.org/" target="_blank">Mercurial</a> will be used in all examples for cloning the projects we will be generating bindings to.
    ----------

  8. zacharycarter revised this gist Feb 28, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion wclwn.md
    Original file line number Diff line number Diff line change
    @@ -37,7 +37,7 @@ This guide is an attempt to empower readers to create their own bindings to othe
    >
    >This guide assumes the reader has a certain amount of familiarity with the C programming language as well as the Nim programming language, however it does not require the reader be an expert in either language.
    >Familiarity with development tooling such as <a href="https://git-scm.com/" target="_blank">git</a> or an equivalent source control management system is also assumed. Git will be used in all examples for cloning the projects we will be generating bindings to.
    >Familiarity with development tooling such as <a href="https://git-scm.com/" target="_blank">git</a> or an equivalent source control management system is also assumed. Git | Mercurial will be used in all examples for cloning the projects we will be generating bindings to.
    ----------

  9. zacharycarter revised this gist Feb 28, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion wclwn.md
    Original file line number Diff line number Diff line change
    @@ -124,7 +124,7 @@ The soloud project is structured as follows :

    The src directory contains the following subdirectories:
    ```
    >.
    .
    ├── audiosource
    ├── backend
    ├── c_api
  10. zacharycarter revised this gist Feb 28, 2017. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions wclwn.md
    Original file line number Diff line number Diff line change
    @@ -105,6 +105,7 @@ The soloud project is structured as follows :
    >**Note**:
    > A summary of the soloud project's directory structure, can be found on the <a href="http://sol.gfxile.net/soloud/dirstruct.html" target="_blank">project's website</a>.
    ```
    .
    ├── AUTHORS
  11. zacharycarter revised this gist Feb 28, 2017. 1 changed file with 35 additions and 0 deletions.
    35 changes: 35 additions & 0 deletions wclwn.md
    Original file line number Diff line number Diff line change
    @@ -272,6 +272,41 @@ Hint: [Link]
    Hint: operation successful (11553 lines compiled; 0.871 sec total; 17.938MiB peekmem; Debug Build) [SuccessX]
    ```
    Assuming that is the case, then congratulations! You have produced your first bindings to a C library with Nim!
    ### Creating a Test
    The final step in binding to any library is writing a simple test to ensure the bindings you have produced work. Let's write one really quickly. Go ahead and issue the following commands -
    ```
    $ wget https://github.com/zacharycarter/soloud-nim/raw/master/examples/test.ogg
    $ touch soloud_test.nim
    ```
    Go ahead and open soloud_test.nim in your preferred text editor, and paste in the following snippet :
    ```
    import soloud_c, times, os
    var i, spin = 0
    var sl : ptr Soloud
    sl = Soloud_create()
    discard Soloud_init(sl)
    Soloud_setGlobalVolume(sl, 1)
    var stream = WavStream_create()
    discard WavStream_load(cast[ptr Wav](stream), "test.ogg")
    let currentTime = epochTime()
    let length = WavStream_getLength(stream)
    discard Soloud_play(cast[ptr Soloud](sl), cast[ptr Wav](stream))
    while epochTime() - currentTime <= length:
    sleep(100)
    Soloud_deinit(sl)
    Soloud_destroy(sl)
    ```
    This test will play an .ogg file and quit after its duration.
    ___
    <i class="icon-desktop"></i>Nuklear
    -------------
  12. zacharycarter revised this gist Feb 28, 2017. 1 changed file with 60 additions and 4 deletions.
    64 changes: 60 additions & 4 deletions wclwn.md
    Original file line number Diff line number Diff line change
    @@ -195,13 +195,39 @@ $ cd gmake
    ##### Windows

    ### Generate Bindings
    Generating bindings for the [soloud](#soloud) audio library couldn't be easier. The only tool we will need is [c2nim](#c2nim). Start by issuing the following commands :
    Generating bindings for the [soloud](#soloud) audio library couldn't be easier. The only tool we will need is [c2nim](#c2nim).
    ##### Installing c2nim
    Before we can use [c2nim](#c2nim) to translate C to Nim, we need to install it. [c2nim](#c2nim) is installed via the Nim package manager <a href="https://github.com/nim-lang/nimble" target="_blank">nimble</a>, which ships with newer versions of Nim. You can verify you have nimble installed by issuing the following command :
    ```
    $ nimble -version
    ```
    If you receive a response similar to :
    ```
    nimble v0.8.3 compiled at 2017-01-21 00:16:21
    ```
    Then nimble is succesfully installed on your system. If this is not the case, please refer to the <a href="https://github.com/nim-lang/nimble#installation" target="_blank">nimble installation guide</a> for installation instructions.

    After verifying your nimble installation you are ready to install [c2nim](#c2nim). To do so, issue the following commands :
    ```
    $ git clone https://github.com/nim-lang/c2nim.git
    $ cd c2nim && nimble install
    ```
    To verify you have successfully installed [c2nim](#c2nim), issue the following command :
    ```
    $ c2nim --version
    ```
    If [c2nim](#c2nim) has been installed successfully, you should receive a response similar to :
    ```
    0.9.12
    ```
    ##### Modifying soloud_c.h
    Before running [c2nim](#c2nim) against the soloud_c.h header file, we need to make some modifications to it. Start by issuing the following commands :
    ```
    $ cd soloud && cd include
    ```
    Find the <a href="https://github.com/jarikomppa/soloud/blob/master/include/soloud_c.h" target="_blank">soloud_c.h</a> header file and open it in your favorite text editor. We are going to add a directive at the top of the file that [c2nim](#c2nim) will parse during its translation process.
    Find the <a href="https://github.com/jarikomppa/soloud/blob/master/include/soloud_c.h" target="_blank">soloud_c.h</a> header file inside the include directory, and open it in your favorite text editor. We are going to add a directive at the top of the file that [c2nim](#c2nim) will parse during its translation process.

    Copy and paste the following at the top of the header file :
    Copy and paste the following into the top of the header file :
    ```
    #ifdef C2NIM
    # dynlib solouddll
    @@ -215,7 +241,37 @@ Copy and paste the following at the top of the header file :
    # endif
    #endif
    ```
    This directive instructs c2nim to annotate the Nim procs and types it produces with various pragmas. The contents of the dynlib pragma specifically, will vary depending on the operating system c2nim is run on.
    This directive instructs [c2nim](#c2nim) to annotate the Nim procs and types it produces with various pragmas. The contents of the dynlib pragma specifically, will vary depending on the operating system [c2nim](#c2nim) is run on.

    This is all we need to do to prepare the header file for [c2nim](#c2nim). As you will see later on in this guide, this is not always the case - more often than not, you will need to spend some time manipulating the contents of the header file in order for [c2nim](#c2nim) to be able to parse it.

    The next step in generating our bindings is actually running c2nim against our modified version of soloud_c.h

    ##### Running c2nim
    To run [c2nim](#c2nim) against our modified header file, issue the following commands :
    ```
    $ c2nim soloud_c.h
    ```
    You should see output similar to :
    ```
    Users/bob/projects/soloud/include/soloud_c.h(502, 1) Warning: comment ' SOLOUD_C_H_INCLUDED' ignored [CommentXIgnored]
    Hint: operation successful (503 lines compiled; 0 sec total; 1.504MiB; ) [SuccessX]
    ```
    This warning can be safely ignored. If you re-examine the include directory's contents you'll notice a new file present : soloud_c.nim

    Feel free to open this file and examine its contents. These are the auto-generated bindings [c2nim](#c2nim) has produced for us.

    ##### Binding compilation
    The last step involved in the generation of our bindings, is to actually compile them. To do so issue the following command :
    ```
    $ nim c soloud_c.nim
    ```
    You will see quite a few compiler hints while the Nim compiler runs. Once it is finished you should see output similar to :
    ```
    Hint: [Link]
    Hint: operation successful (11553 lines compiled; 0.871 sec total; 17.938MiB peekmem; Debug Build) [SuccessX]
    ```
    Assuming that is the case, then congratulations! You have produced your first bindings to a C library with Nim!
    ___
    <i class="icon-desktop"></i>Nuklear
    -------------
  13. zacharycarter revised this gist Feb 28, 2017. 1 changed file with 28 additions and 1 deletion.
    29 changes: 28 additions & 1 deletion wclwn.md
    Original file line number Diff line number Diff line change
    @@ -48,6 +48,8 @@ C2NIM
    This tool dramatically speeds up the process of generating bindings to C libraries. You simply provide it with the path to a C source or header file, and it will attempt to translate its contents from C to Nim.

    The user manual for c2nim can be found <a href="https://nim-lang.org/docs/c2nim.html" target="_blank">here</a>.

    ----------

    The C Preprocessor
    @@ -67,6 +69,7 @@ Nim provides a number of built-in <a href="https://nim-lang.org/docs/manual.html
    It is not necessary to understand what every pragma mentioned in this guide does, or how pragmas work internally, but it is important to know that pragmas will be used and referred to. We will be also using [c2nim](#c2nim) to generate many of the pragmas our bindings will need in order to function.

    Two pragmas which will be referred to frequently throughout this guide, are the cdecl and dynlib pragmas.
    ___

    Before We Begin
    @@ -182,13 +185,37 @@ You'll need the libsoloud.dylib dynamic library file produced in the Products fo
    ```
    $ cp ../../lib/libsoloud.dylib /usr/local/lib
    ```
    The soloud audio library has now been built and installed on your machine.
    The [soloud](#soloud) audio library has now been built and installed on your machine.
    ##### Linux
    ```
    $ cd soloud && cd build
    $ genie gmake
    $ cd gmake
    ```
    ##### Windows

    ### Generate Bindings
    Generating bindings for the [soloud](#soloud) audio library couldn't be easier. The only tool we will need is [c2nim](#c2nim). Start by issuing the following commands :
    ```
    $ cd soloud && cd include
    ```
    Find the <a href="https://github.com/jarikomppa/soloud/blob/master/include/soloud_c.h" target="_blank">soloud_c.h</a> header file and open it in your favorite text editor. We are going to add a directive at the top of the file that [c2nim](#c2nim) will parse during its translation process.

    Copy and paste the following at the top of the header file :
    ```
    #ifdef C2NIM
    # dynlib solouddll
    # cdecl
    # if defined(windows)
    # define solouddll "soloud.dll"
    # elif defined(macosx)
    # define solouddll "libsoloud.dylib"
    # else
    # define solouddll "libsoloud.so"
    # endif
    #endif
    ```
    This directive instructs c2nim to annotate the Nim procs and types it produces with various pragmas. The contents of the dynlib pragma specifically, will vary depending on the operating system c2nim is run on.
    ___
    <i class="icon-desktop"></i>Nuklear
    -------------
  14. zacharycarter revised this gist Feb 27, 2017. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions wclwn.md
    Original file line number Diff line number Diff line change
    @@ -10,6 +10,12 @@ Table of Contents
    * [Pragmas](#pragmas)
    * [Before We Begin](#before-we-begin)
    * [Soloud Tutorial](#soloud)
    * [Nuklear Tutorial](#nuklear)
    * [Bearlib Terminal Tutorial](#bearlib-terminal)
    * [SDL-GPU Tutorial](#sdl-gpu)
    * [Creating Nimian Bindings](#creating-nimian-bindings)
    * [FAQ](#faq)
    * [Credits](#credits)

    -------------
    Introduction
  15. zacharycarter revised this gist Feb 27, 2017. No changes.
  16. zacharycarter revised this gist Feb 27, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion wclwn.md
    Original file line number Diff line number Diff line change
    @@ -81,7 +81,7 @@ It can be extremely beneficial to examine existing tests | examples bundled with
    The <a href="http://sol.gfxile.net/soloud/" target="_blank">soloud</a> audio library bills itself as :
    > ... an easy to use, free, portable c/c++ audio engine for games
    This library was chosen as the first example, because it is a very straightforward project to generate bindings for. The library offers a <a href="http://sol.gfxile.net/soloud/c_api.html" target="_blank>C API</a> which is the API we will be binding to.
    This library was chosen as the first example, because it is a very straightforward project to generate bindings for. The library offers a <a href="http://sol.gfxile.net/soloud/c_api.html" target="_blank">C API</a> which is the API we will be binding to.

    ### Clone Project
    The <a href="https://github.com/jarikomppa/soloud" target="_blank">soloud</a> project is available on github and can be cloned with the command :
  17. zacharycarter revised this gist Feb 27, 2017. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions wclwn.md
    Original file line number Diff line number Diff line change
    @@ -82,6 +82,7 @@ The <a href="http://sol.gfxile.net/soloud/" target="_blank">soloud</a> audio lib
    > ... an easy to use, free, portable c/c++ audio engine for games
    This library was chosen as the first example, because it is a very straightforward project to generate bindings for. The library offers a <a href="http://sol.gfxile.net/soloud/c_api.html" target="_blank>C API</a> which is the API we will be binding to.

    ### Clone Project
    The <a href="https://github.com/jarikomppa/soloud" target="_blank">soloud</a> project is available on github and can be cloned with the command :
    ```
  18. zacharycarter revised this gist Feb 27, 2017. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions wclwn.md
    Original file line number Diff line number Diff line change
    @@ -198,5 +198,7 @@ Creating Nimian Bindings
    FAQ
    -------------

    Credits
    -------------
    ----------
    ######Guide authored and maintained by <a href="https://github.com/zacharycarter" target="_blank">Zachary Carter</a>
  19. zacharycarter revised this gist Feb 27, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion wclwn.md
    Original file line number Diff line number Diff line change
    @@ -143,7 +143,7 @@ $ git clone https://github.com/bkaradzic/genie
    $ cd genie
    $ make
    ```
    This will build GENie, and place an executable inside the bin/OS/ directory. Copy this executable to a location contained within your operating system's PATH environment variable, or add the genie/bin/OS/ folder to your system's PATH environment variable.
    This will build GENie, and place an executable inside the bin/OS/ directory. Copy this executable to a location contained within your operating system's PATH environment variable, or add the genie/bin/OS folder to your system's PATH environment variable.

    To test your GENie installation, you can issue the following command -
    ```
  20. zacharycarter revised this gist Feb 27, 2017. No changes.
  21. zacharycarter revised this gist Feb 27, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion wclwn.md
    Original file line number Diff line number Diff line change
    @@ -20,7 +20,7 @@ One of the many wonderful features of the Nim programming language is its <a hre
    This guide is an attempt to empower readers to create their own bindings to other libraries or code written in C. It will walk readers through a few examples demonstrating how bindings were created to some rather complex C libraries, and we'll also create brand new bindings to a C library which bindings don't yet exist for :
    >**Note:**
    >
    >The author of this guide spends most of his time developing video games, and tools used for building them. Therefore the focus of the libraries presented in this guide will be game development related.
    >The author of this guide spends most of his spare time developing video games, and tools used for building them. Therefore the focus of the libraries presented in this guide will be game development related.
    #### <a class="icon-file" href="https://github.com/jarikomppa/soloud" target="_blank">Soloud : 3D Audio Engine</a>
    #### <a class="icon-file" href="https://github.com/vurtun/nuklear" target="_blank">Nuklear : Immediate Mode GUI Library</a>
  22. zacharycarter revised this gist Feb 27, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion wclwn.md
    Original file line number Diff line number Diff line change
    @@ -145,7 +145,7 @@ $ make
    ```
    This will build GENie, and place an executable inside the bin/OS/ directory. Copy this executable to a location contained within your operating system's PATH environment variable, or add the genie/bin/OS/ folder to your system's PATH environment variable.

    To test GENie installation, you can issue the following command -
    To test your GENie installation, you can issue the following command -
    ```
    $ genie --version
    ```
  23. zacharycarter revised this gist Feb 27, 2017. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions wclwn.md
    Original file line number Diff line number Diff line change
    @@ -82,13 +82,13 @@ The <a href="http://sol.gfxile.net/soloud/" target="_blank">soloud</a> audio lib
    > ... an easy to use, free, portable c/c++ audio engine for games
    This library was chosen as the first example, because it is a very straightforward project to generate bindings for. The library offers a <a href="http://sol.gfxile.net/soloud/c_api.html" target="_blank>C API</a> which is the API we will be binding to.
    #### Clone Project
    ### Clone Project
    The <a href="https://github.com/jarikomppa/soloud" target="_blank">soloud</a> project is available on github and can be cloned with the command :
    ```
    git clone https://github.com/jarikomppa/soloud.git
    ```
    Perform this command in whatever directory you would like to use as your workspace for this tutorial. This command will create a new folder named 'soloud' and will checkout the soloud project into it.
    #### Explore Project
    ### Explore Project
    Now that the project has been cloned, its time to explore its structure and determine exactly what will need to be done in order to generate bindings to the library.

    The soloud project is structured as follows :
    @@ -134,7 +134,7 @@ What we are looking for instead, is the file where all of the types and methods
    The soloud project follows this convention, and you may have noticed that the directory structure of the project includes a folder named 'include'.

    Inside the include folder resides a header file named <a href="https://github.com/jarikomppa/soloud/blob/master/include/soloud_c.h" target="_blank">soloud_c.h</a>. Defined inside of this header file, are all of the types and methods that the C API exposes. The bindings we create will be Nim equivalents of these definitions.
    #### Build project
    ### Build project
    The first and only prerequisite for building the [soloud](#soloud) library, is installing the build tool it uses, <a href="https://github.com/bkaradzic/GENie" target="_blank">GENie</a>. You can either download precompiled binaries available via the project's github page, or build and install the project yourself.

    To do so issue the following commands -
  24. zacharycarter revised this gist Feb 27, 2017. 1 changed file with 21 additions and 1 deletion.
    22 changes: 21 additions & 1 deletion wclwn.md
    Original file line number Diff line number Diff line change
    @@ -155,13 +155,33 @@ And if GENie is installed correctly you will receive a response similar to -
    GENie - Project generator tool <auto generated do not change>
    https://github.com/bkaradzic/GENie
    ```
    Assuming GENie was installed successfully, soloud is ready to be built. To do so on a POSIX | Windows operating system is rather trivial.

    The first step in building soloud, is generating project files via GENie. If you encounter any troubles while generating project files with GENie, consult the manual by typing.
    ```
    $ genie --help
    ```
    Next, issue the following commands, depending on which operating system you are using.
    ##### OSX
    ```
    $ cd soloud && cd build
    $ genie gmake
    $ genie xcode4
    $ cd xcode4
    $ open SoLoud.xcworkspace
    ```
    Once Xcode is open, you'll want to switch to the SoloudDynamic project and add the AudioToolbox and CoreAudio frameworks to the project. After doing so the project should build without issue.

    You'll need the libsoloud.dylib dynamic library file produced in the Products folder later in this tutorial. To prevent yourself from having to do so later, you can install the library to your /usr/local/lib directory with the following commands:
    ```
    $ cp ../../lib/libsoloud.dylib /usr/local/lib
    ```
    The soloud audio library has now been built and installed on your machine.
    ##### Linux
    ```
    $ cd soloud && cd build
    $ genie gmake
    $ cd gmake
    ```
    ___
    <i class="icon-desktop"></i>Nuklear
    -------------
  25. zacharycarter revised this gist Feb 27, 2017. 1 changed file with 13 additions and 2 deletions.
    15 changes: 13 additions & 2 deletions wclwn.md
    Original file line number Diff line number Diff line change
    @@ -145,10 +145,21 @@ $ make
    ```
    This will build GENie, and place an executable inside the bin/OS/ directory. Copy this executable to a location contained within your operating system's PATH environment variable, or add the genie/bin/OS/ folder to your system's PATH environment variable.

    To test GENie installation, you can issue the following command -
    ```
    $ genie --version
    ```

    And if GENie is installed correctly you will receive a response similar to -
    ```
    GENie - Project generator tool <auto generated do not change>
    https://github.com/bkaradzic/GENie
    ```

    ##### OSX
    ```
    cd soloud && cd build
    genie gmake
    $ cd soloud && cd build
    $ genie gmake
    ```
    ##### Linux
    ___
  26. zacharycarter revised this gist Feb 27, 2017. 1 changed file with 10 additions and 2 deletions.
    12 changes: 10 additions & 2 deletions wclwn.md
    Original file line number Diff line number Diff line change
    @@ -135,8 +135,16 @@ The soloud project follows this convention, and you may have noticed that the di

    Inside the include folder resides a header file named <a href="https://github.com/jarikomppa/soloud/blob/master/include/soloud_c.h" target="_blank">soloud_c.h</a>. Defined inside of this header file, are all of the types and methods that the C API exposes. The bindings we create will be Nim equivalents of these definitions.
    #### Build project
    The first and only prerequisite for building the [soloud](#soloud) library, assuming
    ##### Windows
    The first and only prerequisite for building the [soloud](#soloud) library, is installing the build tool it uses, <a href="https://github.com/bkaradzic/GENie" target="_blank">GENie</a>. You can either download precompiled binaries available via the project's github page, or build and install the project yourself.

    To do so issue the following commands -
    ```
    $ git clone https://github.com/bkaradzic/genie
    $ cd genie
    $ make
    ```
    This will build GENie, and place an executable inside the bin/OS/ directory. Copy this executable to a location contained within your operating system's PATH environment variable, or add the genie/bin/OS/ folder to your system's PATH environment variable.

    ##### OSX
    ```
    cd soloud && cd build
  27. zacharycarter revised this gist Feb 27, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion wclwn.md
    Original file line number Diff line number Diff line change
    @@ -69,7 +69,7 @@ Before We Begin

    When binding to another library, it is often desirable, and necessary to have built the source code for the library you plan on binding to, and installed any libraries or other artifacts the build process produces. This guide will include instructions for building each library, but it is recommended that readers familiarize themselves with popular C|C++ build tools such as <a href="https://cmake.org/" target="_blank">CMake</a>, <a href="https://premake.github.io/" target="_blank">premake</a>, and <a href="https://github.com/bkaradzic/GENie" target="_blank">GENie</a>.

    This guide will **NOT** cover instructions for using specific OS package managers, or instructions for installing any libraries other than those directly related to the tutorials presented below.
    This guide will **NOT** contain instructions for using specific OS package managers, or instructions for installing any libraries other than those directly related to the tutorials presented below.

    **Tests**:

  28. zacharycarter revised this gist Feb 27, 2017. 1 changed file with 4 additions and 2 deletions.
    6 changes: 4 additions & 2 deletions wclwn.md
    Original file line number Diff line number Diff line change
    @@ -67,7 +67,9 @@ Before We Begin
    -------------
    **Building dependent libraries**:

    When binding to another library, it is often desirable, and necessary to have built the source code for the library you plan on binding to, and installed any libraries or other artifacts the build process produces. This guide will include instructions for building each library, but it is recommended that readers familiarize themselves with popular C|C++ build tools such as CMake, premake, and genie.
    When binding to another library, it is often desirable, and necessary to have built the source code for the library you plan on binding to, and installed any libraries or other artifacts the build process produces. This guide will include instructions for building each library, but it is recommended that readers familiarize themselves with popular C|C++ build tools such as <a href="https://cmake.org/" target="_blank">CMake</a>, <a href="https://premake.github.io/" target="_blank">premake</a>, and <a href="https://github.com/bkaradzic/GENie" target="_blank">GENie</a>.

    This guide will **NOT** cover instructions for using specific OS package managers, or instructions for installing any libraries other than those directly related to the tutorials presented below.

    **Tests**:

    @@ -133,7 +135,7 @@ The soloud project follows this convention, and you may have noticed that the di

    Inside the include folder resides a header file named <a href="https://github.com/jarikomppa/soloud/blob/master/include/soloud_c.h" target="_blank">soloud_c.h</a>. Defined inside of this header file, are all of the types and methods that the C API exposes. The bindings we create will be Nim equivalents of these definitions.
    #### Build project
    The first step of building
    The first and only prerequisite for building the [soloud](#soloud) library, assuming
    ##### Windows
    ##### OSX
    ```
  29. zacharycarter revised this gist Feb 27, 2017. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions wclwn.md
    Original file line number Diff line number Diff line change
    @@ -132,7 +132,7 @@ What we are looking for instead, is the file where all of the types and methods
    The soloud project follows this convention, and you may have noticed that the directory structure of the project includes a folder named 'include'.

    Inside the include folder resides a header file named <a href="https://github.com/jarikomppa/soloud/blob/master/include/soloud_c.h" target="_blank">soloud_c.h</a>. Defined inside of this header file, are all of the types and methods that the C API exposes. The bindings we create will be Nim equivalents of these definitions.
    #### Build Soloud
    #### Build project
    The first step of building
    ##### Windows
    ##### OSX
    @@ -158,4 +158,4 @@ FAQ
    -------------

    ----------
    ######Guide written and maintained by <a href="https://github.com/zacharycarter" target="_blank">Zachary Carter</a>
    ######Guide authored and maintained by <a href="https://github.com/zacharycarter" target="_blank">Zachary Carter</a>
  30. zacharycarter revised this gist Feb 27, 2017. 1 changed file with 10 additions and 3 deletions.
    13 changes: 10 additions & 3 deletions wclwn.md
    Original file line number Diff line number Diff line change
    @@ -67,7 +67,7 @@ Before We Begin
    -------------
    **Building dependent libraries**:

    When binding to another library, it is often desirable, and necessary to have built the source code for the library you plan on binding to, and installed any libraries or other artifacts the build process produces. This guide will assume the reader possesses the knowledge needed to do so, and will simply link to build instructions where applicable.
    When binding to another library, it is often desirable, and necessary to have built the source code for the library you plan on binding to, and installed any libraries or other artifacts the build process produces. This guide will include instructions for building each library, but it is recommended that readers familiarize themselves with popular C|C++ build tools such as CMake, premake, and genie.

    **Tests**:

    @@ -127,13 +127,20 @@ If we take a look in the c_api folder, we'll find the following:
    ```
    The file <a href="https://github.com/jarikomppa/soloud/blob/master/src/c_api/soloud_c.cpp" target="_blank">soloud_c.cpp</a> contains the implementation for the soloud C API. Since we are going to bind to, and eventually be calling the C code, we need not concern ourselves with the details of the library's implementation.

    What we are looking for instead, is the file where all of the types and methods the implementation source file references, are defined. Generally in most C/C++ projects these definitions and implementations are split into header or include, and source files. By convention, header | include files are typically placed in a folder named 'include', however this is not always the case.
    What we are looking for instead, is the file where all of the types and methods the implementation source file references, are defined. Generally in most C|C++ projects these definitions and implementations are split into header or include, and source files. By convention, header | include files are typically placed in a folder named 'include', however this is not always the case.

    The soloud project follows this convention, and you may have noticed that the directory structure of the project includes a folder named 'include'.

    Inside the include folder resides a header file named <a href="https://github.com/jarikomppa/soloud/blob/master/include/soloud_c.h" target="_blank">soloud_c.h</a>. Defined inside of this header file, are all of the types and methods that the C API exposes. The bindings we create will be Nim equivalents of these definitions.
    #### Build Soloud
    For instructions on building the Soloud audio library
    The first step of building
    ##### Windows
    ##### OSX
    ```
    cd soloud && cd build
    genie gmake
    ```
    ##### Linux
    ___
    <i class="icon-desktop"></i>Nuklear
    -------------