Skip to content

Instantly share code, notes, and snippets.

@anosatsuk124
Created November 11, 2023 06:30
Show Gist options
  • Save anosatsuk124/942ec5d069920111ffef0c12202b11dd to your computer and use it in GitHub Desktop.
Save anosatsuk124/942ec5d069920111ffef0c12202b11dd to your computer and use it in GitHub Desktop.
# Horrible example of how to interface with a C++ engine ... ;-)
{.link: "/usr/lib/libIrrlicht.so".}
{.emit: """
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;
""".}
const
irr = "<irrlicht/irrlicht.h>"
type
IrrlichtDeviceObj {.header: irr,
importcpp: "IrrlichtDevice".} = object
IrrlichtDevice = ptr IrrlichtDeviceObj
proc createDevice(): IrrlichtDevice {.
header: irr, importcpp: "createDevice(@)".}
proc run(device: IrrlichtDevice): bool {.
header: irr, importcpp: "#.run(@)".}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment