0

I'm very new to Haxe, and specifically want to use it to produce C++ code from Haxe (actually the flow would be AS3->Haxe, then Haxe->C++). My understanding is that Haxe compiles Haxe directly to a (C++) executable. But does it explicitly output the generated source?

Can/does Haxe supply the C++ code that it produces in this process? -- As I could then take and use this source within another C++ cross-compiler such as Marmalade (with modifications, of course).

I'm wondering about the intensiveness of the conversions, also. If Haxe does produce/supply the C++ source, then what does this source look like? Is e.g. memory management all packaged up into native DLLs/SOs? In that case, it seems like Haxe wouldn't be an ideal option.

(Disclaimer: I'm just trying to get some preliminary information before I go down this road. In fact, more specifically, I want to port from AS3 to C++ for Marmalade. So I want to know if it is worth writing my own converter or if Haxe provides a viable alternative.)

Gama11
  • 31,714
  • 9
  • 78
  • 100
Engineer
  • 8,529
  • 7
  • 65
  • 105
  • I'm curious, why do you want to turn AS3 code into C++? – Pubby Jan 22 '13 at 17:58
  • 2
    http://haxe.org/doc/start/cpp claims it does, "Haxe code can be transformed into C++ and then compiled using your system's C++ toolchain". Should be easy enough to look in the directory you specify with the `-cpp` option, see what's there and what the coding style is like. – Steve Jessop Jan 22 '13 at 17:58

2 Answers2

1

If you're looking to go from AS3->C++ through Haxe, then you should check out NME. It allows you to use the Flash Player API to write applications to compile to native ones (through the C++ backend), swfs and html5 applications.

Also it offers a whole workflow for assets and such. And it has pretty good integration with FlashDevelop (windows only) and MonoDevelop, but you can of course use any IDE.

back2dos
  • 15,588
  • 34
  • 50
  • Hi & thanks for your answer. I looked at NME, and as I understand it, it compiles to iOS or Android native C++? My concern is that I'm looking to port this AS3 over to C++ for Marmalade, and preferably in a single step, i.e. not using an intermediate converter. – Engineer Jan 23 '13 at 14:49
  • Does your question not state "actually the flow would be AS3->Haxe, then Haxe->C++"? – back2dos Jan 23 '13 at 14:54
  • I'm asking you to elaborate on the details, i.e. what sort of code Haxe/NME will output. If you can answer that, I can accept your answer. – Engineer Jan 23 '13 at 14:59
  • NME outputs whatever you tell it to ;) You can compile to Flash, C++, Android, iOS, BlackBerry (both essentially special variations of C++)... I'm sure I forgot some targets, but that's the most popular ones, I think :) – T045T May 19 '13 at 20:23
0

Yes, Haxe outputs the source for you. Haven't ever looked into it very deeply, but it's there. When you compile for a C++ target (e.g. Windows) the source can be found under bin\cpp\windows\obj.

Macca
  • 43
  • 1
  • 6