bguiz
bguiz

Reputation: 28587

Compiling a Haxe library without a Main class

I'm writing a library in Haxe that does not expose a "Main" class. Instead it simply contains typedefs & classes, which are intended for use in other applications which are compiled including this library.

If I try to compile without a -main option, I get the following error:

Haxe Compiler 3.2.1 - (C)2005-2015 Haxe Foundation
 Usage : haxe -main <class> [-swf|-js|-neko|-php|-cpp|-as3] <output> [options]

Does the Haxe compiler prevent you from compiling a library that doesn't have an entry point?


Upvotes: 2

Views: 400

Answers (1)

Cambiata
Cambiata

Reputation: 3845

You can compile without a main using something like the following build.hxml:

-cp src 

# add the package(s) that you want to include the following way: 
--macro "include('package1.foo')"
--macro "include('package2.bar.test.buz')"
...

-js bin/index.js

Hope this helps!

Upvotes: 7

Related Questions