Questions related to Native method implementations

Kelkar, Anand akelkar at
Mon Jun 9 15:30:14 PDT 2008



I created my AS class and defined some native methods and implemented
them in C++. If I use that class in AS and instantiate it and call
methods my code in C++ is executed properly. 


Now I want to how to create an instance of that AS class from C++ side.
So I think I know the steps but not sure how to do it.

-          I will first have to find classclosure for my AS class in my
domain environment

-          Use that classclosure to create a new object of type subclass
of ScriptObject

-          Find method I want to call inside ScriptObject

-          Execute that method


I tried looking in tamarin-devel archives and found one thread related
to this

"how to add my own objects?
l>   Mark Hammond

But it does not have the full answer to my questions about how to
instantiate as AS class (which has native methods implemented in C++)
from C++.


Can somebody help me with this.





P.S. I also have some other questions related to this which I sent
sometime back to a wrong address, I guess.


From: Kelkar, Anand 
Sent: Friday, May 30, 2008 3:19 PM
To: 'tamarin-devel at'
Subject: Questions related to Native method implementations




I am trying to implement few methods of a sample AS3.0 class as native
methods. In that process I am able to use macros like BEGIN_NATIVE_MAP
and define C++ impmentations for the native methods. Also able to build
the AS3.0 class and generate header file defining all constatnts related
to class, methods name etc and map AS3.0 class with my C++ class.  I am
also hitting the code inside my native C++ methods when functions are
called on object of that AS3.0 class. But I have comple of questions
related to implementations of native methods. 

-          How to interpret arguments passed to native member functions
of classes that we have added?  Especially if those are not native like
boolean, string, ints etc. How to interpret 'object' type parameters?

-          How to return a valid data type from a native function which
is not a simple data type like int, bool etc? 

-          How to map/interpret AS3.0 class member properties defined
inside AS class definition to member variables inside C++ class that is
used to implement native methods?

-          Is it possible to access other AS3.0 class static members
like constants from C++.

Are there any good examples of such implementations. I tried looking
mostly at StringBuilder, ByteArray implementations in avmshell but most
of them have native parameters such as int, bool, string etc.

Thanks in advance.


-------------- next part --------------
An HTML attachment was scrubbed...

More information about the Tamarin-devel mailing list