Skip to content

Instantly share code, notes, and snippets.

@eranws
Created September 15, 2017 06:17
Show Gist options
  • Save eranws/56351739d6ee1fde0591a7b568ccbdae to your computer and use it in GitHub Desktop.
Save eranws/56351739d6ee1fde0591a7b568ccbdae to your computer and use it in GitHub Desktop.
libred quickstart

A quick tutorial embedding red into c

0. Install Red

1. When red is installed, enter:

red build libred

this will result in these files created in the directory:

libRed.dylib            847872 
libRed/
    libRed.def          596
    libRed.lib          11650
    libRed.red          21194
    red.h               4927

2. create this test.c file

#include "red.h"

int main() {
    redOpen();
    redPrint(redString("Hello World!"));
    redClose();
    return 0;
}

3. Compile using this line

gcc -arch i386 test.c -Ilibred -L. -lRed -o test

4. Run

./test

should print "Hello world"

Tested with Red-0.6.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment