Is there a way to expose a Haxe library as a library for another target

(Zicklag) #1


I wanted to know whether or not there is a way for me to write a library in Haxe and compile it to a library built for another platform. For example, if I wrote a library that was a Haxe implementation of some algorithm, could I compile that to a Java .jar, a Python library, a Javascript module, and .so/.dll shared libraries? It seems like that could be very useful, especially for people who want to develop SDK’s or libraries for interacting with a tool or platform for a collection of languages.

(Dmitry Hryppa) #2

Yes, you can do this.
Check this for a start point:

Also, here is additional information:

HXCPP can create C++ libs as well with -D static_link and -D dll_export

Hope it helps! :slight_smile:

(Aleksandr Kuzmenko) #3

It’s definitely possible.
A few years ago I’ve created a library which simulated a battle system of a Clash-Of-Clans-like game, which was compiled as a shared library for a c++ clients on ios and android (with an attempt to integrate it as a js library + js vm), as a php library on server and as swf library for an as3 client.
Js, php and swf were pretty easy to implement. The most troubles were caused while implementing a shared c++ lib for different OSes and architectures.

(Zicklag) #4

Wow! Cool! It’s great that Haxe can do that. This could be very useful. :+1: