[email protected] wrote on 12/15/2010 03:05:56 PM:
> Hi, Igor
>
> I have a quick question. The @Native annotation can support passing
> the reference of X10 object? For example, consider like this;
> -------------------------------------
> [Driver.x10]
> @NativeCPPInclude("test.h")
> @NativeCPPCompilationUnit("test.cc")
> class Driver {
> public static def main(args: Array[String](1)) {
> var myClass:MyClass = new MyClass("a", "b");
> { @Native("c++","foo(myClass);") {} }
> ...
> }
> -------------------------------------
> [MyClass.x10]
> class MyClass {
> ...
> }
> -------------------------------------
Hi, Myoungkyu,
Yes, you can pass an X10 object reference. In your example, the variable
myClass will have the type x10aux::ref<MyClass>, and you can write your
functions accordingly. When in doubt, just declare a method foo() in X10
and look at the generated C++ code -- as long as you mimic that in your
code, you can access X10 objects.
Igor
--
Igor Peshansky (note the spelling change!)
IBM T.J. Watson Research Center
X10: Parallel Productivity and Performance (http://x10-lang.org/)
XJ: No More Pain for XML's Gain (http://www.research.ibm.com/xj/)
"I hear and I forget. I see and I remember. I do and I understand" --
Xun Zi
------------------------------------------------------------------------------
Lotusphere 2011
Register now for Lotusphere 2011 and learn how
to connect the dots, take your collaborative environment
to the next level, and enter the era of Social Business.
http://p.sf.net/sfu/lotusphere-d2d
_______________________________________________
X10-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/x10-users