Calling back from C++ library

I am trying to call back to ActionScript from my C++ code. So far I could get only generic functions, e.g.,
AS3_Val traceObj = AS3_NSGetS(NULL, "trace");
I could not get or call any class or function I defined. What am I missing?
C++ code:
AS3_Val tNS = AS3_String("alchemy.test"); // I tried others, e.g., "", "cmodule.libtest"
AS3_Val tClass = AS3_NSGetS(tNS, "callback");       // tClass is 0, so AS3_Call() does not work...
AS3_Val t2Class = AS3_NSGetS(NULL, "myCallback");   // t2Class is 0
AS3_Val tMsg = AS3_String("Hello");
AS3_CallTS("myCallback", NULL, "StrType", tMsg);    // does not work
AS:
package alchemy.test {
    public class libtest {
        static public function callback(msg:String):int {
            return _lib.callback(msg);
MXML:
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" applicationComplete="init()">
    <mx:Script>
        <![CDATA[                       
            public function myCallback(msg:String):void
                trace(msg);
        ]]>
    </mx:Script>
</mx:WindowedApplication>
Thank you,
Csaba

I found a way to call functions I created but it's not the most elegant solution.  In short, I found that you need to call a function pointer to the function you intend to call.  I'm going from memory so I apologize if it does not compile.  Still, it should give you the basic idea.
ActionScript
public class A
     public var callbackPtr:Function = callback();
public function A()
     var loader:CLibInit = new CLibInit;
     var alchemyClass  = loader.init();
     alchemyClass.setA(this);
     alchemyClass.callAS()
public function callback():Function
function callbackTrace(bytes:ByteArray):void
trace("callback...");
return callbackTrace;
C
AS3_Val classA;
AS3_Val setA(void *self, AS3_Val args)
classA = AS3_Undefined();
AS3_ArrayValue(args, "AS3ValType", & classA);
return AS3_Null();
AS3_Val callAS(void *self, AS3_Val args)
     AS3_CallS("callbackPtr", classA, AS3_Null());
     return AS3_Null();

Similar Messages

  • Call-backs from XMLP Templates

    Hi,
    Does anyone know if call-backs are supported in XMLP? That is to say, is there a way to call back from the template to Java Objects to retrieve calculated values at report runtime?
    To be more specific, I am looking for a generic version of the barcode class tag (below) that would allow interfacing with any Java class.
    <?register-barcode-vendor:’oracle.apps.xdo.template.rtf.util.barc
    oder.BarcodeUtil’;’XMLPBarVendor’?>
    Thanks.
    Message was edited by:
    najeeb

    Hi Najeeb,
    Did you make the barcode work?? We are also having problem in generating barcode formatted value on fly.
    Please let me know if you have any luck.
    Thanks,
    Ram.

  • Lost music library on ipod; how to sync it back from music library?

    somehow I lost all my music on my ipod, although the music is still in the library on desktop
    tried clicking "transfer purchases" under device but that did not work. also couldn't manually move titles from library to device icon on the left while ipod was connected
    how can I get my music back on the ipod from the library?
    many thanks

    Same way you got it there in the first place.
    Either select the music to sync or manually manage the music.
    http://manuals.info.apple.com/enUS/iPod_touch_3.1_UserGuide.pdf

  • All MSI R9 270x gaming 2g are corrupt! NEED CALL BACK FROM MSI!

    Yea!
    I got a BAD MSI R9 270x 2g gaming card.. I have switch it for a new one same model many times and still have that artifact problem I have REINSTALL MY PC 10X with windows 8.1 64bit (maybe this video card is not working with windows 8.1 64bit...)
    And don't say the standard apology "its your power supply" thats inpossible I have an Enermax Revolution87+ ERV750AWT-G and I tried on an other PC and still the same ISSUE with the last 14.4 driver and the old MSI DRIVER 13 MY PC work with I7 4770K (not OC yet) O yea I have only 1 GPU and not in CrossFIRE!
    And yea there is no new Vbios available... And AMD is in SLAX MODE with making a NEW DRIVER!
    So HOW TO FIX THIS PROBLEM ?? I can't switch my video card in store everytime they will think ?? AGAIN! WITH THE SAME PROBLEM!?
    And you know I'm not the only person that is angry on MSI with this corrupt VIDEO CARD MODEL! 
    Maybe (you MSI )need to ask all MSI R9 270x gaming 2g (With Serial number XXXXXXXX)back from costummers and give us a new one without PROBLEMS for free!
    I WILL REALY BURN MY VIDEO CARD WITH FIRE! AND BUY NEVER A MSI AGAIN! If there is no solution for this corruption..

    This is a USER to USER forum and no one from MSI is here so you will get no reply from them by posting on this forum >>How to contact MSI.<<
    if you want someone to help you please supply us a list of all the parts your using please! (if you have had Multiple cards and all are showing artefacts something else is going wrong could be RAM, Driver (13.12 is usually the most stable as the 14.xx versions have some Bad bugs in them) or a Faulty PSU (if its not the RAM or Drivers then its usually that))
    Also between installing drivers please wipe out the old ones completely using this >>Driver Fusion<< in safe mode to clean out any fragments the normal AMD un-installer leaves behind like Regestery keys and Profiles ect!
    so please follow this >>Posting Guide<< and give us a list of the parts your using please!

  • Transfer the call back from iPhone to Macbook

    Hi,
    As you know there is a limitation to join the conference calls from mac book. We cannot use # or * to confirm the passcode to join the call.
    Is there any way to hand off the call from iPhone to Macbook?
    Thanks,
    Vamshi.

    You're welcome.
    Just noticed you're on a Mac...look at this:
    http://www.ecamm.com/mac/phoneview/
    Either or...PhoneView only works on OS X.

  • Asynchronous Call Back from ODI to BPEL

    I am trying to implement the example for the article Asynchronously Invoke ODI Scenario from BPEL Process with Callback in OTN.
    However I am not able to download the OBE_LABS directory.I guess they have changed the location.
    Can anyone share the folder with me.
    Thanks
    Raj.

    Can someone please help me on this...
    Thanks
    Raj

  • What do you have to do to get a call back from applecare ?

    i ahve tried numerous times but they have not called me

    Please call again, where are you located you haven't bothered to complete your profile so we know nothing about your system or where you are located. If you are not sure how to update your profile please click Profile Update for instructions. It will not show up in this thread but will in future threads. You can also use the AppleCare Contact Info link.

  • How can I transfer data (iTunes/iPhoto) MacBook Pro (Late 2011) to my brand new iMac 27" - Apple Support couldn't help me and did not make the promised call-back

    I have a late 2011 MacBook Pro 13" and bought a brand new iMac 27" last week.
    I tried to transfer data (musdic & photos) via Thunderbolt, but i did not run, my system always
    tries to transfer data via WLAN, but that would last more than 80 hours.
    I tried to get some help from the Apple Support, but unfortunately they couldn't help me.
    A promised call-back from the next higher support-level has not been done.
    Does anybody know what the problem might be.
    The Thunderbolt-cable is brand new.

    Instead of using Migration Assistant, the best way is to use the Target Disk Mode, so you will save headaches (Migration Assistant creates a new user with the transferred data).
    To do this, just connect both Macs with the Thunderbolt cable, and then, start the MacBook Pro holding the T key, so a Thunderbolt or FireWire icon should appear on the display. After that, go to the iMac, open Finder, and the hard drive of the MacBook Pro will appear on the Finder sidebar as an external drive, under "Devices". Just access to it, go to the folders with your iTunes and iPhoto libraries, and copy them to the iMac

  • "Deadlock in safepoint code. Should have called back to the VM"

    We experience a VM crash in Safepoint.cpp with the following message:
    # An unexpected error has been detected by Java Runtime Environment:
    # Internal Error (safepoint.cpp:558), pid=5452, tid=1900
    # Error: Deadlock in safepoint code. Should have called back to the VM before blocking.
    # Java VM: Java HotSpot(TM) Client VM (11.0-b16 mixed mode windows-x86)
    # If you would like to submit a bug report, please visit:
    # http://java.sun.com/webapps/bugreport/crash.jsp
    This happens in JRE 1.6.0.11 + Microsoft VS2008 C++, on Windows Server 2003. Happens in a busy customer site once in every few days, cannot reporoduce in the lab.
    There are two relevant threads:
    * Thread A: Created in Java right after system start up. It makes some preparations and then calls C++ code via JNI. In the JNI, Java data types are converted to C++ data types by GetBooleanArrayElements() and GetStringUTFChars(). It remains in C++ forever (until shutdown) and calls back the Java code via JNI every few seconds (that is: the stack contains Java frames, then C++ frames, then from time to time more Java frames and even further C++ frames).
    * Thread B: Created upon need, invokes a C++ function via JNI, converts parameters by GetStringUTFChars() and at return by ReleaseStringUTFChars(). The function may take few milliseconds and up to few minutes to complete, eventually it returns to Java and the thread is deleted.
    At time of crash we see the following:
    * Most of the threads in the system are in state threadblocked - we guess that the VM blocked them for GC.
    * Thread A is the active one. As far as we can tell it is in Java (called back from C++), maybe trying to invoke a C++ function via JNI. It locked and released a mutex ("synchronized") just before the crash (we suspect that while performing this lock its thread's Safepoint state may have changed to callback). The thread state is threadin_native_trans.
    * Thread B is blocked in the JNI trying to return to Java, maybe while invoking ReleaseStringUTFChars(). It's state is threadblocked.
    Another important detail: the crash happens usually certain time (few seconds or even few minutes) after thread B is blocked, and always while thread A is in Java called back from C++. We guess that something caused the Safepoint locking to wait forever while thread B tried to returns to from C++ to Java, and that the activity of thread A make the Safepoint realize that there's a deadlock (so its activity it's not the root cause but a side-effect).
    We always see two mutex / monitors with name UNKNOWN at time of error, and 100% "eden" memory utilization.
    hotspot error dump fragment:
    --------------- T H R E A D ---------------
    Current thread (0x26d51400): JavaThread "DialogicBridge" [_thread_in_native_trans, id=1900, stack(0x28490000,0x284e0000)]
    Stack: [0x28490000,0x284e0000]
    [error occurred during error reporting (printing stack bounds), id 0xc0000005]
    Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
    j telemessage.telephony.DialogicBridge.initializeDialogic(Ljava/lang/String;IIIIIIIIIIIILjava/lang/String;Ljava/lang/String;ILjava/lang/String;Ljava/lang/String;Ljava/lang/String;ILjava/lang/String;Ljava/lang/String;IZZ[Z)I+0
    j telemessage.telephony.DialogicBridge$1.run()V+293
    j java.lang.Thread.run()V+11
    v ~StubRoutines::call_stub
    0x2ed00400 JavaThread "<< Call#16207 >> " [_thread_blocked, id=8604, stack(0x2e5c0000,0x2e610000)] // this is thread B
    =>0x26d51400 JavaThread "DialogicBridge" [_thread_in_native_trans, id=1900, stack(0x28490000,0x284e0000)] // this is thread A
    Other Threads:
    0x269f7000 VMThread [stack: 0x26a80000,0x26ad0000] [id=2104]
    0x26a29000 WatcherThread [stack: 0x26cb0000,0x26d00000] [id=9300]
    VM state:synchronizing (normal execution)
    VM Mutex/Monitor currently owned by a thread: ([mutex/lock_event])
    [0x002a8be0] UNKNOWN - owner thread: 0x269f7000
    [0x002a9040] UNKNOWN - owner thread: 0x2ed00400
    Heap
    def new generation total 2816K, used 2707K [0x02730000, 0x02a30000, 0x04e90000)
    eden space 2560K, 100% used [0x02730000, 0x029b0000, 0x029b0000)
    from space 256K, 57% used [0x029f0000, 0x02a14f50, 0x02a30000)
    to space 256K, 0% used [0x029b0000, 0x029b0000, 0x029f0000)
    tenured generation total 30272K, used 17667K [0x04e90000, 0x06c20000, 0x22730000)
    the space 30272K, 58% used [0x04e90000, 0x05fd0d88, 0x05fd0e00, 0x06c20000)
    compacting perm gen total 12288K, used 10995K [0x22730000, 0x23330000, 0x26730000)
    the space 12288K, 89% used [0x22730000, 0x231ecdf8, 0x231ece00, 0x23330000)
    No shared spaces configured.

    Thanks for the advice.
    Eventually (after few days of digging) we found that in certain case we're using the JNIEnv of one thread in the other thread. This leads to sporadic crashes. We managed to simulate the situation in the lab and ensure that fixing the JNIEnv mixture really makes the problem go away.

  • UCCX Call Back After Adjustable Time Period

    I have been asked to create a script that allows a person to call in, enter their phone number, and after a certain number of minutes a call back is initiated. I have found the script from the script repository named BaseLineAdvQueuing which has call back builtin, but I am curious how I could create some sort of timer that is adjustable based on caller input to schedule the call back. For example, "enter the number of minutes before you wish to recieve a call back from the system" the person may enter 45 and this would set the ball rolling for the call back a quarter of an hour later.
    Any ideas how I could acomplish the timer aspect of this?
    Thank you for your input!

    This can get complicated, especially if your call center is already complicated.  Basically, you are going to need to write records to your database.  Have a scheduled task check your database entries for records which need to be processed for callback.  Have UCCX initiated via an HTTP Trigger.  That script will then place a call to your CSQ script, wait for an Agent, and then connect the Agent to the caller.
    Some challenges you might face:
    Scripting UCCX for such a solution
    DB design and access
    Error handling/User experience
    Consideration for EWT
    Consideration for which CSQ
    Reporting
    Cisco will not support you on this, so whatever you do, make it as simple as possible while still achieving the goal.  You're going to need to support it yourself.
    Good luck.

  • Invoking call back functions

    Hi there,
    While a client can invoke server side functions on the bean, is there anyway we can invoke a client side function (call back) from the bean itself?

    Not within EJB, but there are many ways to communicate. RMI and JMS would be two possibilities; though I would be a bit suspicious about the legality of using RMI from within an EJB, JMS is perfectly acceptable.

  • Client Call back and socket permissions

    Hi,
    Im thinking of a client call back from the server. I dont know much about the RMI under a firewall.
    Do I need to make an entry in the firewall proxy server so that the RMI Server make a call back to the client?
    Or the client can directly call a server behind a fire wall and a server can make a client which is behind a fire wall too.
    Any suggestions, please let me know.
    Thanks,
    ananth

    Servers cannot "call back" to clients behind firewalls. Period.
    Clients can call servers behind firewalls, but you will probably have to provide a custom socket factory so that a fixed port - rather than a random port - is used for remote method calls.

  • Randomly generating movieClips from the library onto the stage

    Hi
    I am trying to call objects from the library for a collection game.
    Having major issues with the best way to assign the good objects and the bad objects to later update a score.
    Can anyone help me with how i can first assign the movieClips from the library into a good and bad array and then after randomally fill the stage with them.
    Regards
    James

    again and always when testing in the ide, use the trace() function to debug your code:
    public function checkCollisions()
                                  for (var i:int = objects.length - 1; i >= 0; i--)
                                            if (Point.distance(new Point(gamesprite.car.x,gamesprite.car.y),new Point(objects[i].x,objects[i].y)) < pickupDistance)
                                                      if (objects[i].hitTestobjects(gamesprite.car))
                                                                if (objects[i].typestr == "good")
                                                                          score +=  10;
                                                                          trace(score);
                                                                else
                                                                          score -=  4;
                                                                          trace(score);
                                                                if (score < 0)
                                                                          score = 0;
                                                                scoreDisplay.text = String(score);
    trace(scoreDisplay.text);
                                                                removeChild(objects[i]);
                                                                objects.splice(i,1);
    if you don't see any trace() output, you can conclude that part of your code is not executing.  if see trace output, you can don't see the same value in scoreDisplay, you can conclude you're not seeing your scoreDisplay textfield.

  • Meeting Place and Webex Call Back Failing

    Hi
    Meeting place 8.5 with WebEx scheduling, SIP trunk to CUCM 8.5.
    Calling in using the specified number configured in call manager completes over the SIP trunk however call back from webex fails.
    Error:
    WebEx call back failed; no answer.
    Problem is I never recieve a call. I have enabled Webex call backs in webex.
    Seems like there is an issue on either MP or CUCM.
    Just looking for some ideas as I am stumped.

    This turned out to be a few things:
    1) I needed to configure a SIP proxy to CUCM from meeting place. This was the CUCM IP address and TCP port number.
    2) The SIP trunk security profile needed to be reconfigured for this trunk.
    3) E164 was being used so I created a translation pattern to strip the + for the CSS associated with the RP.
    A few things learned along the way.
    1) The "activity" command ran from a SSH prompt with allow you to simulate a call from meeting place. Option 4, enter the number to dial and "f" for port.
    2) In meeting place - Services -Logs - System Information Capture - Loading the index file and under the  CCA SIP LOG is the error being returned by CUCM. In my case it was Warning: 399 CSLCCM1 "Unable to find a device handler for the request received on port
    3) Command "cptrace" again from the SSH prompt will allow you to view the digits being sent from webex to meeting place.
    I hope this information helps someone...

  • How to call back to C via JNI in Java started from C?

    Hi!
    This problem might seem outlandish, but I have not been able to find any other method to reach my goal. The situation is the following.
    There is a C++ program I intend to interface with a piece of Java code, called the manager. The C++ code invokes a VM, starts a Java glue code, that connects to the manager via RMI. This works fine. The glue code, however, can be called from the manager, via RMI as well. The problem is, that these calls should in turn call functions in the C++ code, that originally started the Java glue code. JNI can only load a library, but this is not what I want to do now. I want to somehow connect back to the C code that started the Java code. Is this possible at all?
    Thanks for your help,
    Ambrus

    What you want to do is not too tough, but there will be some details to be worked through. In particular, you have to figure out how to make your "callback" get from your "glue" code back into your C++.
    1. Calling back out is from java to C is pretty easy. There is a JNI function for registering a native method with the JVM. Here is an example of the registration code:
    // See if the service interface class is known.
    javaClass = javaEnv->FindClass("JavaInterfaceObject");
    if (javaClass != 0) {
    //Register a native method to place java server messages in the service log.
    // Define the service logger native method.
    JNINativeMethod methods[] = {
    {"addToMessageLog", "(Ljava/lang/String;)V", Java_addToMessageLog}
    // Register the method with the jvm.
    javaEnv->RegisterNatives(javaClass, methods, 1);
         javaEnv->ExceptionClear();     // Just in case not found.
         return TRUE;
    2. You have to define the native method:
    * Native method - callback to place java server messages in the service log.
    JNIEXPORT void JNICALL Server::Java_addToMessageLog(JNIEnv * javaEnv, jclass javaClass, jstring javaMsg) {
         jboolean     isCopy;
         const char* msg = javaEnv->GetStringUTFChars(javaMsg, &isCopy);
         Server::theServer->logger->addToMessageLog((char*)msg);
         if (isCopy)
              javaEnv->ReleaseStringUTFChars(javaMsg, msg);
    3. The real headache is that this is C code, not C++. In other words, if you really need to call into C++, then you need to seed your callback so that it has a pointer to the appropriate C++ object.

Maybe you are looking for

  • Username and Password for Pushes to a Team Foundation Server

    Hello, I have a team foundation server with a collection of projects, all of which use Git for their version control.  One of my projects, is basically a bunch of Excel files with macros, so I do all my source code editing in Excel's VBA editor and n

  • Upgrading Oracle Text - Post upgrade step 10.2 to 11.2

    I already upgraded my 10.2.0.4 database to 11.2.0.1 and have to do post upgrade steps. In step 39 of Manual guideline (837570.1) is not clear for me. If some one can explain further would be appriciated. When i check my source ORACLE_HOME/ctx/admin/c

  • Itunes match is making itunes non responsive

    Hi! Ive been looking into this issue on both the "itunes windows" and the "match" forums with no real luck. I updated my itunes, it is fully updated on all things i use. I left itunes back in Jan2013 because at that point only being able to add my de

  • AS2-1.1..Unable to Deliver MDN

    Dear Experts, We are having a tough time sending an MDN back to our partner, I mean the Oracle B2B is is unable to delver. Here is what we found.. * We configured AS2-1.1, where are our partner is using AS2-1.2 * We are successfully sending receiving

  • Execute query and Message Box Problem!

    Hi, I have a procedure to built undo function : declare ls_row varchar2(55); ls_item varchar2(55); begin go_block(:parameter.l_current_block); ls_row := :m_form.rowid; execute_query; if ls_row is null then return; end if; loop exit when :m_form.rowid