Skip to content
This repository has been archived by the owner on Dec 10, 2022. It is now read-only.

Latest commit

 

History

History
24 lines (20 loc) · 796 Bytes

index.md

File metadata and controls

24 lines (20 loc) · 796 Bytes
layout title
default
Haxe Embed C

It is possible to embed C/C++/Objective-C code in JTransc. Using @HaxeMeta and using hxcpp tricks.

Example: https://github.com/jtransc/jtransc-examples/blob/master/cpp/src/example/Test.java

{% highlight java %}{% raw %} public class Test { static public void main(String[] args) { System.out.println(Demo.mysum(7, 3)); } }

@HaxeMeta("@:cppInclude('./../test.c')") @HaxeAddFilesTemplate("test.c") class Demo { @HaxeMeta("@:noStack") @HaxeMethodBody(target = "cpp", value = "return untyped cpp('::sum({0}, {1})', p0, p1);") static native public int mysum(int a, int b); } {% endraw %}{% endhighlight %}