webidl

WebIDL support for Haxe
https://github.com/ncannasse/webidl

To install, run:

haxelib install webidl 1.0.0 

See using Haxelib in Haxelib documentation for more information.

README.md

Haxe WebIDL

This library allows to access any C++ library from Haxe/JS (using Emscripten or Web Assembly) and Haxe/HashLink by simply defining an idl file.

For a complete example, see the sample

Given the following IDL file:

interface Point {
	attribute long x;
	attribute long y;
	void Point();
	void Point( long x, long y );
	[Operator="*",Ref] Point op_add( [Const,Ref] Point p );
	double length();
};

And the following Haxe code (strictly typed thanks to IDL definitions):

class Sample {

	public static function main() {
		var p1 = new Point();
		p1.x = 4;
		p1.y = 5;
		var p2 = new Point(7,8);
		var p = p1.op_add(p2);
		trace('Result = ${p.x},${p.y} len=${p.length()}');
		p1.delete();
		p2.delete();
		p.delete();
	}
	
}

This compiles to the following Javascript:

// Generated by Haxe 4.0.0
(function () { "use strict";
var Sample = function() { };
Sample.main = function() {
	var this1 = _eb_Point_new0();
	var p1 = this1;
	_eb_Point_set_x(p1,4);
	_eb_Point_set_y(p1,5);
	var this2 = _eb_Point_new2(7,8);
	var p2 = this2;
	var p = _eb_Point_op_add1(p1,p2);
	console.log("sample/Sample.hx:11:","Result = " + _eb_Point_get_x(p) + "," + _eb_Point_get_y(p) + " len=" + _eb_Point_length0(p));
	_eb_Point_delete(p1);
	_eb_Point_delete(p2);
	_eb_Point_delete(p);
};
Sample.main();
})();
Contributors
ncannasse
Version
1.0.0
Published
7 years ago
License
BSD

All libraries are free

Every month, more than a thousand developers use Haxelib to find, share, and reuse code — and assemble it in powerful new ways. Enjoy Haxe; It is great!

Explore Haxe

Haxe Manual

Haxe Code Cookbook

Haxe API documentation

You can try Haxe in the browser! try.haxe.org

Join us on GitHub!

Haxe is being developed on GitHub. Feel free to contribute or report issues to our projects.

Haxe on GitHub