Skip to content

Commit

Permalink
Enhancing README about libobjectscript.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ingwie Phoenix committed Jun 1, 2015
1 parent d179b06 commit 5aa62f2
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,41 @@ cd build

This will update all the binaries within your build folder and make them find the library - hopefuly.

Using ObjectScript in your app
====================

After installing ObjectScript, you also will get the required headers into your system to utilize ObjectScript in your app. This is especially useful to let the user do something within your app. Here is an example:

app.cpp:
```cpp
#include <objectscript.h>

using namespace ObjectScript;

int main(int argc, char** argv) {
OS* os = OS::create();

// simulate calling "print()" with given argv
os->getGlobal("print");
os->newArray(argc);
for(int i=0; i<argc; i++) {
os->pushString(argv[i]);
os->addProperty(-2);
}
os->callF(1);
}
```
Now, compile it just like this:
g++ app.cpp -o app -lobjectscript
To do so on Windows, copy the resulting `libobjectscript.lib` and `src/objectscript.h` to your project, and compile as:
cl app.cpp libobjectscript.lib /I. /Fe:app
The library and headers are installed globally into your installation path's `include` folder.
Nginx config example (for __os-fcgi__)
====================
Expand Down

0 comments on commit 5aa62f2

Please sign in to comment.