dangel 0.5.0

D AngelScript binding


To use this package, run the following command in your project's root directory:

Manual usage
Put the following dependency into your project's dependences section:

DAngel

D bindings and wrapper for AngelScript with support for D strings.

Do note this is still work in progress and there's currently issues with D calling conventions breaking with angelscript (will be working on patching angelscript to support D calling conventions)

This library also depends on a patched C binding to angelscript that you will need to compile first, you can find that here

Why?

Because I can, especially with the string support. I'm sorry in advance, there's some cursed GC stuff going on there and I'm not sure whether it will leak memory at some point.

Using the binding

First compile AngelScript and the patched c bindings AS DYNAMIC LIBRARIES and install the libraries to your system's library path (or whatever the heck you do on Windows)

Then put the libraries somewhere that the D linker will be able to find them, in my case that's /usr/lib and /usr/include. You may want to ship the libraries with your application.

Once you have that sorted, just compile your application with dub and it should link to the libraries, hopefully...

Using D strings

To enable D string support register the D string subsystem in angelscript like this:

    import as.addons.str : registerDStrings;
    ScriptEngine engine = ScriptEngine.create();
    engine.registerDStrings();

    // Register all your other stuff and execute your scripts.

Registering D types

Currently DAngel supports registering a few D types automatically, one being integer enums. To register a D integer enum do the following:

    enum MyEnum {
        Item1,
        Item2,
        Item3 = 42,
    }

    // After this call the enum will be available to your scripts.
    engine.registerEnum!MyEnum;

There's experimental and buggy support for registering D structs in as.addons.dwrap. I don't recommend using it currently, though.

There's parts of the API missing!

I know, there's also a lot of places where I haven't done any error handling yet that will just fail silently. It will be fixed with time.

My functions don't run correctly!

I know, there's some incompatibility between AngelScript and the D ABI's calling conventions, changing the calling convention to the C calling convention via extern(C) and marking your function as asCDECL should work around it temporarily.

I'll be working on making a patched version of AngelScript that supports the D calling convention unless the creator of AngelScript decides to add it themself.

Authors:
  • Luna Nielsen
Dependencies:
none
Versions:
0.7.0 2020-Dec-28
0.6.0 2020-Nov-16
0.5.5 2020-Nov-10
0.5.0 2020-Nov-08
~main 2020-Dec-28
Show all 5 versions
Download Stats:
  • 0 downloads today

  • 0 downloads this week

  • 0 downloads this month

  • 23 downloads total

Score:
0.9
Short URL:
dangel.dub.pm