My callback function under MFC is never called back!

I am developming a MFC application using NIDAQ 6.7 driver and PCI-DIO-6533
for a new
data adquisition system at the Jicamarca Radio Observatory. It is my first
project with the
PCI card. I am having problems with the CALLBACK functions. Following are
relevant portions
of the source code that illustrates my problem:
void CallbackNidaq()
int j;
j=1234;
TRACE("I have entered the callback function \n");
void CCAMUView:nCallbackNidaq()
HWND my_hwnd = m_hWnd ;
u32 direcion=0 ;
puntero = (unsigned char *)piBuffer;
puntero[4*NSAMPLES-1]=0;
puntero[4*NSAMPLES-2]=0;
puntero[4*NSAMPLES-3]=0;
puntero[4*NSAMPLES-4]=0;
iStatus = Config_DAQ_Event_Message(iDevice,(i16)1,//add message
"DIGRP0" , // string description
(i16)0 , // DAQEvent 0-> Adquire N scans
(i32)NSAMPLES , /*DAQTrigVal0*/
(i32)0 , //DAQTrigVal1
(u32)0 , //trigSkipCount
(u32)0 , //preTrigScans
(u32)0 , //postTrigScans
0 , // hwnd
0 , // to post WM_NIDAQ_MSG
(u32)CallbackNidaq) ; // function address
TRACE("I have already configured : status = %d\n",iStatus);
int iStatus2;
iStatus2 = DIG_Block_In(iDevice, iGroup, piBuffer, ulCount);
TRACE("I have started asinc Status2 = %d",iStatus2);
Sleep(1000);
TRACE("Buffer= %d %d %d %d \n",puntero[4*NSAMPLES-1],puntero[4*NSAMPLES-2],pu​ntero[4*NSAMPLES-3],puntero[4*NSAMPLES-4]);
What I expect to happen is as follows:
After I configure the device I should get the first TRACE messages I do. I get
"I have already configured : status = 0" ,
"I have started asinc Status2 = 0"
To make sure the device has actually read a buffer full of data, I print out the contents of the last
four bytes which have been previously set to cero. They do show new values.
My problem is that the callback
function is never triggered.I never get the ""I have entered the callback
function"
message.
For your information, in case it helps. I have used the compiler debug to
find out the address of CallbackNidaq()
but it does not aggree with the address I get for the (u32)CallbackNidaq
address assign to the last argument of
the Config_DAQ_Event_Message function.
I would appreciate very much if you tell me What I am doing wrong.
Wishes.
Gabriel

Hello Gabriel,
the propotype of your callback function is wrong; must be (without CALLBACK keyword):
void CallbackNidaq(HWND handle, UINT message, WPARAM wParam, LPARAM lParam)
See the Config_DAQ_Event_Message in NI-DAQ Help at the bottom.
Hope this will help you.
Grettings,
Alain

Similar Messages

  • Calling a method from a callback function under ARC

    Hi All
    I previously wrote some HIDManager software. The HIDManager references were done in a Objective C class so within this object you have the code:
        IOHIDManagerRegisterDeviceMatchingCallback( k8055HIDManager, k8055BoardWasAdded, (__bridge void*)self );
    Which registers with the HIDManager
    The Callback function which is outside the class was as follows:
    static void k8055BoardWasAdded(void* inContext, IOReturn inResult, void* inSender, IOHIDDeviceRef k8055HIDDevice)
        IOHIDDeviceOpen(k8055HIDDevice, kIOHIDOptionsTypeNone);
        CCVellemanK8055Driver * k8055 = (__bridge CCVellemanK8055Driver *)inContext;
        [k8055 setHardwareConnectionStatus : YES];
    Any how my problem is in converting the code to ARC as under OS X 10.9 SDK and 64bit I'm now getting a EXC_BAD_ACCESS (Code=EXC_I386_GPFLT) at this line
        CCVellemanK8055Driver * k8055 = (__bridge CCVellemanK8055Driver *)inContext;
    although removing the method
    [k8055 setHardwareConnectionStatus : YES];
    will alow it to build but then obviously the app won't work as required.
    Could someone suggest a ARC safe way of accessing the passed instance so I can again call methods on it.
    Cheers
    Steve

    Try using blocks instead. This is the callback I am using for libcurl.
    static size_t callback(
      void * contents, size_t size, size_t nmemb, void * context)
      size_t (^block)(void *, size_t) =
        (__bridge size_t (^)(void *, size_t))context;
      size_t result = block(contents, size * nmemb);
      return result;

  • For all those who say Verizon never calls back.

    I tried to activate a STB last night that was picked up at a store just before closing. The box would not activate, even after the Cable CARD did an automatic firmware update. I contacted Customer Support and the box still would not activate because of some type of pending order on my account. Normal tech support agents cannot access accounts, for the customers protection, and theirs.
    I was told that I would receive a return call within one to two hours. WOW! Within 15 minutes a supervisor called back and said the issue was resolved with the pending order for some type of future activation. Glitch? But the Supervisor had the box up and running within 30 minutes, and staid on the phone with me until I could go upstairs and Verify the proper operation.
    Kudos to Verizon and their Fiber Solutions Center CSRs!

    that would explain why I never get a call back - my guy was busy calling you

  • How to implement a call back service?

    hi all,
    i have a method which calls a particular function module. i want to achieve the following two things in the code:
    1. after calling the function module, i want the program flow to get paused - it should wait for a notification from the function module to proceed further.
    2. the function module should send a call back to the method intimating that it is done with the job.
    due to the scenario, synchronous call wil not solve the purpose. i need to use explicit wait and notificaion / call back service.
    any help would be greatly appreciated. thank you.
    rgds,
    ram

    Hello. Have you taken a look at  CALL FUNCTION ... STARTING NEW TASK ...
    See example below. Regards, Peter
    DATA: INFO LIKE RFCSI,
    Result of RFC_SYSTEM_INFO function
          SEMAPHORE(1) VALUE SPACE,    "For WAIT condition
          MSG(80)      VALUE SPACE.    "Handling of exceptions
          RET_SUBRC LIKE SY-SUBRC.     "Handling of SUBRC
    CALL FUNCTION 'RFC_SYSTEM_INFO'
         STARTING NEW TASK 'INFO'
         DESTINATION 'NONE'
         PERFORMING RETURN_INFO ON END OF TASK
         EXCEPTIONS
             COMMUNICATION_FAILURE = 1 MESSAGE MSG
             SYSTEM_FAILURE        = 2 MESSAGE MSG.
    IF SY-SUBRC = 0.
      WRITE: 'Wait for reply'.
      WAIT UNTIL SEMAPHORE = 'X'.
      IF RET_SUBRC <> 0.
         WRITE MSG.
      ELSE.
        WRITE: / 'Destination =', INFO-RFCDEST.
      ENDIF.
    ELSE.
      WRITE MSG.
    ENDIF.
    FORM RETURN_INFO USING TASKNAME.
      RECEIVE RESULTS FROM FUNCTION 'RFC_SYSTEM_INFO'
          IMPORTING  RFCSI_EXPORT = INFO
          EXCEPTIONS
             COMMUNICATION_FAILURE = 1 MESSAGE MSG
             SYSTEM_FAILURE        = 2 MESSAGE MSG.
      RET_SUBRC = SY-SUBRC. "Set RET_SUBRC
      SEMAPHORE = 'X'. "Reset semaphore
    ENDFORM.

  • How to implement a callback function using LabView's Call Library Function Node?

    I am trying to call a fuction from a SDK.dll library using the Call Library Function Node. The SDK was provided to
    me and I do not have the source code, just the .dll and .h files.
    The SdkSetPropertyEventHandler function has a callback fuction as one of its parameters. How do I implement the
    callback using the CLF node? I am a good LabView programmer but this is my first time using the Call Library
    Function Node. I have read all the info I can find on NI's web site and the discussion board but cannot figure
    this one out. I am using LabView 8.6.
    The SDK.h deacribes the function as:
    //  Function:   SdkSetPropertyEventHandler
    SdkError SDKAPI SdkSetPropertyEventHandler(
                SdkCameraRef                    inCameraRef,
                SdkPropertyEvent                inEvnet,          
                SdkPropertyEventHandler         inPropertyEventHandler,
                SdkVoid*                        inContext );
    //  Description:
    //       Registers a callback function for receiving status
    //          change notification events for property states on a camera.
    //  Parameters:
    //       In:    inCameraRef - Designate the camera object.
    //              inEvent - Designate one or all events to be supplemented.
    //              inPropertyEventHandler - Designate the pointer to the callback
    //                      function for receiving property-related camera events.
    //              inContext - Designate application information to be passed by
    //                      means of the callback function. Any data needed for
    //                      your application can be passed.
    //      Out:    None
    //  Returns:    Any of the sdk errors.
    A separate header file called SDKTypes.h contains the following data:
    typedef  SdkUInt32  SdkPropertyEvent;
    typedef  SdkUInt32  SdkPropertyID;
    typedef  void       SdkVoid;
    typedef  struct __SdkObject*    SdkBaseRef;
    typedef  SdkBaseRef    SdkCameraRef;
     SdkPropertyEventHandler
    typedef SdkError ( SDKCALLBACK *SdkPropertyEventHandler )(
                        SdkPropertyEvent        inEvent,
                        SdkPropertyID           inPropertyID,
                        SdkUInt32               inParam,
                        SdkVoid *               inContext );
    Thanks for your help.
    Alejandro
    Solved!
    Go to Solution.

    alejandroandreatta wrote:
    I am trying to call a fuction from a SDK.dll library using the Call Library Function Node. The SDK was provided to
    me and I do not have the source code, just the .dll and .h files.
    The SdkSetPropertyEventHandler function has a callback fuction as one of its parameters. How do I implement the
    callback using the CLF node? I am a good LabView programmer but this is my first time using the Call Library
    Function Node. I have read all the info I can find on NI's web site and the discussion board but cannot figure
    this one out. I am using LabView 8.6.
    Basically you do not do that. LabVIEW does not know pointers and certainly not function pointers. What you should do instead is writing a C DLL that implements the callback and also exports a function to be called by LabVIEW that translates between the callback and a LabVIEW user event. Look for PostLVUserEvent() here on the NI site to find examples how to do that.
    Rolf Kalbermatter
    Message Edited by rolfk on 02-11-2009 08:00 PM
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • I am trying to write a double buffered data acquisition program using MFC and a callback function.

    i am trying to do a double buffer data acquisition using MFC application framework in Visual Studio.i want to use a callback function to notify when the buffer is half full.do you have some sample reference program that can help me?

    What DAQ board are you using? When you installed NI-DAQ you should have selected to install the support files for VC++. Then there will be several examples on how to do double buffered data acquisition.
    If you have already installed NI-DAQ 6.8 or higher and did not select to include the support files, you can run the NI-DAQ setup program and just add them. If you are using an older version, you will have to uninstall and reinstall.
    Once you have the support files, follow this path to the examples.
    >>Program Files>>National Instruments>>NI-DAQ>>Examaples>>Visual C>>
    If you are doing digital acquistion, goto the di folder, if you are doing analog acquisition goto the ai folder.
    As for the callback function, you can use the NI-DAQ function Config_DAQ_
    Event_Message with DAQEvent Type = 1, where N would equal half your buffer.
    Brian

  • DAQmxRegisterEveryNSamplesEvent is never called in MFC environment

    Hello? I'm uing DAQmx8.9 version with Visual  C++ 6. DAQmxRegisterEveryNSamplesEvent is never called in MFC environment.
    Do I have to upgrade to .Net base compiler? I have Visual Studio 2008 and will install this tomorrow to see if this may work in .Net compiler.
    I searched this forum and found I was not alone having this issue.
    Regards,
    Message Edited by anarkie on 08-05-2009 10:12 AM
    I'm converting DAQ to DAQmx..from Parkoz.com

    Anarkie,
    Thanks for posting on the NI Forums! From some of the documents that I was able to find it appears as though with DAQmx and using MFC you need to use VS 2003/2005/2008 for the best success. I am guessing that the reason you are having these problems is from using VS 6. I have attached the document I found that describes these points in more detail. Thanks!
    Programming NI-DAQ in Visual C++ .NET (MFC)
    Aaron W.
    National Instruments
    CLA, CTA and CPI

  • Call Java Method from Callback function

    I am writing a JNI wrapper in c++ for a particular event driven DLL. The DLL makes a network connection to another device and then calls a callback function when events are raised on the device. The DLL has 3 basic functions: connect, disconnect, and registerEventListener. RegisterEventListener takes a function pointer which is called each time an event is raised on the device.
    My wrapper DLL exposes connect and disconnect functions via JNI. I can call these functions just fine from my Java code. Now the question... How do I call a Java method from my c++ callback function? I can call a Java method using env->CallXXXMethod(...) from within a function that is accessible to Java but I don't have access to the JNI parameters in my Callback function.
    So how do I call a Java method from a callback function? If this cannot be done then what is the "right way" to handle native event notification with JNI?

    jschell wrote:
    JNI parameters? Meaning what exactly?
    General outline of a callback
    1. Entry
    2. Get the VM, env - there are methods for this
    3. Attach the thread
    4. Get a java object - how depends on what you are doing, but create it or a static reference.
    5. Get the java method
    6. Call the java method.That is exactly correct. The callback function is called from a separate thread so using a cached pointer to JNIEnv, obtained from the original native method, crashes the JVM. The jmethodID and jclass objects (which are needed to call the static Java method) can be cached without problem. The following is the code I used to attach the current thread and call my static method.
    void MyClass::onEvent(int system_id, char* data)
         //get a pointer to the Java Environment
         JNIEnv *env;
         jvm->AttachCurrentThread((void **)&env, NULL);
         //Call the Java method with the newly aquired data
         jstring js = env->NewStringUTF(data);
         env->CallStaticVoidMethod(cls, mid, system_id, js);
    }My last question is about cleanup in this function. When I use NewStringUTF to "convert" my char* to jstring do I need to do anything special to clean up or will the Java garbage collector take care of it since the jstring is being passed to a Java method?
    Thanks for you help

  • PL/SQL Call Back function is never called

    Hi, I have a AQ set to run a PL/SQL Call Back procedure, but the procedure is never called.
    Oracle version is 11.2.0.2 Standard Edition
    When I query aq$<queue>, the MSG_STATE column is always "ready".
    This is the queue creation script
    begin
      DBMS_AQADM.CREATE_QUEUE_TABLE ( queue_table => 'POLERMESSAGE',
                                      queue_payload_type => 'POLER_MESSAGE',
                                      multiple_consumers => TRUE );
      DBMS_AQADM.CREATE_QUEUE( queue_name => 'POLER_QUEUE',
                               queue_table => 'POLERMESSAGE');
      dbms_aqadm.add_subscriber( queue_name => 'POLER_QUEUE',
                                 subscriber => sys.aq$_agent( 'POLER_RECIPIENT', null, null ) );    
      dbms_aq.register ( sys.aq$_reg_info_list( sys.aq$_reg_info('POLER_QUEUE:POLER_RECIPIENT',
                                                                 dbms_aq.namespace_aq,
                                                                 'plsql://tr',
                                                                 HEXTORAW('FF')) ) ,
                           1 );    
      DBMS_AQADM.START_QUEUE(queue_name => 'POLER_QUEUE');    
    end;
    /This is the content of "tr" procedure
    create or replace
    procedure tr ( context raw,
                           reginfo sys.aq$_reg_info,
                           descr sys.aq$_descriptor,
                           payload raw,
                           payloadl number)
    as
      dequeue_options dbms_aq.dequeue_options_t;
      message_properties dbms_aq.message_properties_t;
      message_handle RAW(16);
      message poler_message;
    BEGIN
      dequeue_options.msgid := descr.msg_id;
      dequeue_options.consumer_name := descr.consumer_name;
      DBMS_AQ.DEQUEUE(queue_name => descr.queue_name,
                      dequeue_options => dequeue_options,
                      message_properties => message_properties,
                      payload => message,
                      msgid => message_handle);
      insert into lxtr values ( Nvl( To_Char(message.PolerMsgNro ), 'ooops' ), systimestamp ) ;
      commit ;
    end tr;If I query sys.reg$, I see it registered there:
    SQL> select subscription_name, location_name, status, state from sys.reg$;
    SUBSCRIPTION_NAME
    LOCATION_NAME
       STATUS     STATE
    "SPARCS"."POLER_QUEUE":"POLER_RECIPIENT"
    plsql://tr
            0         0I was working, until I re-compiled (don't ask...) the trigger that enqueue the message
    This is the section of the trigger (post insert for each row) that do the enqueuing. It seems to be working, since it is enqueuing. The issue is the dequeue.
    DECLARE
      enqueue_options dbms_aq.enqueue_options_t;
      message_properties dbms_aq.message_properties_t;
      message_handle RAW(16);
      message poler_message;
      err varchar2(2000);
    BEGIN
        message := poler_message(PolerMsgId,  PolerMsgNro );
        dbms_aq.enqueue(queue_name => 'POLER_QUEUE',
                        enqueue_options => enqueue_options,
                        message_properties => message_properties,
                        payload => message,
                        msgid => message_handle);
    END;If I run the code below, message is cleanly dequeued
    declare
      dequeue_options      dbms_aq.dequeue_options_t;
      message_properties   dbms_aq.message_properties_t;
      message_handle       RAW(16);
      message              poler_message;
    BEGIN
      dequeue_options.consumer_name := 'POLER_RECIPIENT' ;
      dbms_aq.dequeue( queue_name => 'POLER_QUEUE',
                       dequeue_options       => dequeue_options,
                       message_properties    => message_properties,
                       payload               => message,
                       msgid                 => message_handle);
      COMMIT;
    END ;Can anyone please give me any hints on what should I do next. There is nothing on the alert log...
    Thank you in advance,
    Tiago

    1) Very few PL/SQL programmers would consider it good form to have procedures with excessive numbers of parameters. In any language, though, it's possible to write poor code.
    2) Initially, you're right-- the performance of properly defined SQL statements via JDBC is little different than the performance of PL/SQL stored procedures. Frequently, however, SQL statements in Java applications do not take advantage of bind variables, which will significantly limit their scalability. Maintaining SQL statements in client applications makes it significantly more difficult on the support side-- if you find a bug in a stored procedure, you can fix the bug in one place-- if you find a bug in embedded SQL, you have to fix the code everywhere the client is deployed. Maintaining PL/SQL stored procedures also makes optimization easier-- frequently your DBA will be able to boil down a stored procedure to a couple of SQL statements and vastly improve performance (i.e. INSERT INTO <<table name>> SELECT <<column list>> from <<other table>> rather than looping over a cursor doing single-row inserts). Finally, PL/SQL stored procedures enable reuse-- when the next application wants to access the database, it doesn't have to rewrite your SQL.
    3) If the alternative to the bind variables (?'s) is a bunch of literals, I'll spend the extra time writing the code for the tremendous increase in scalability.
    4-6) You can certainly pass classes from Java to PL/SQL and back. You can also write Java stored procedures, rather than writing PL/SQL stored procedures). Oracle has been one of the leading proponents of Java.
    Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • In VB6, why is the "GPIBNotify sub" (from the GPIBNotify AtiveX Ctrl) all the time called even if no Event happened? This callback function is started then stopped permanently as if its received SRQ from the GPIB Bus. Any ideas?

    I'm programming in Visual Basic 6 to communicate between a computer and HP Measurement Devices (BER-Meter) with GPIB. I have already read information and code for this. My platform is W98. The NI488.2 commands can be sent without any problem between the equipements. However when I'm using the GPIBNotify ActiveX Control to use the callback function, there is a permanent starting and stop of the GpibNotify Sub. The SetupMask and RearmMask are set to RQS and the HP Device is well configured. Moreover an oscilloscope measuring the 10th line (SRQ
    ) of the bus didn't show any pulse on the line behalf the right one. Any Idea?

    Hello-
    So, the SRQ is not detected by the oscilloscope? It must be a setting that is not correct with the instrument. Try contacting the manufacturer of the instrument for details about SRQ's. The GPIBNotify ocx will not be able to react to an SRQ if there isn't one.
    Randy Solomonson
    Application Engineer
    National Instruments

  • PSSigValGetAPLabelProc callback is never called, why?

    I am understanding DigSig example, and am going to convert it to a proper dig signing plugin. So far i have understood the dig sig creation, validation and sig appearance creation satisfactorily, but what i cannot understand is why my PubSec registered plugin's (Acrobat 9 sdk example) two call backs are not called ever.
    These are:  PSSigValGetAPLabelProc  and   PSGetLogoProc. Actually, I need to be able to update layers n1 and n3 depending on the status of the signature validation whenever a PDF is opened. From the documentation I’ve learned that the above callbacks is where I should put my code.
    In SigCreateAPNXObj callback there is a comment:
    // You must have n1 and n3 generated if you want your PSSigValGetAPLabelProc callback invoked
    From this I deduced that I should at least specify n1 or n3. So I added the n1 layer in this method, like so:
    xObjArray[0] = DigSigAPXObjectFromLogo(cosDoc, stmUnknownData, 0, &stmUnknownBBox, &bboxRec);
    but still PSSigValGetAPLabelProc is not getting called (I m debugging the plugin btw). I have checked that this call back is set at registration time aswell.
    Kindly, help me.

    Thank you very much for your very prompt replies.
    Just to make absolutely sure, i have read this paragraph in one of adobe's documents:
    "Note:Prior to Acrobat 6.0, signature appearances were manipulated at run-time in order to display the validity of the signature. The validity was shown as a graphic icon and with an additional, optional text message. The manipulated portions of the signature appearance were contained in layers n1, n3 and n4. Beginning with version 6, Acrobat does not maintain support for signature appearances that can be manipulated, though legacy signatures with these appearances may continue to display correctly. Use of layers n1, n3, and n4 is not recommended."
    1 - Does "legacy signatures" in above statement mean, signatures created via plugins created via legacy/older techniques?
    2 - if i create my plugin using a legacy method i would be able to manipulate the nX layers during sig verification?
    3 - And by "Legacy signatures", you mean Signatures created using DigSig registered plugin or plugin using older acrobat SDK?
    One more thing. I inserted below question in my previous response just before your response came, so there is a possibility that it didt reach you.
    4 - Is it possible to call .Net library from Acrobat Plugin via c++/CLI layer?
           Or
           Is it possible to use .Net dll from with in Acrobat Plugin, using anyother method, like windows service or something?
    Thanks in advance for all the help that you have given so far, and for very prompt replies.

  • Callback function is called with sys user context.

    1. Create AQ Queue table
    2. Create AQ Queue "MyQueue"
    3. Start Queue "MyQueue"
    4. Register "Subscriber1"
    5. Register "MyQueue"."Subscriber1" with Notification URL : PLSQL:\\Mypackage.SP_Callback
    Till here everything is fine...
    6. Enqueue message into "MyQueue" with "Subscriber1" as recipient.
    7. Now AQ notification is fired and as a result Its calling "Mypackage.SP_Callback".
    Here the problem is "Mypackage.SP_Callback" is called from SYS user context. i.e if i capture the dbuser its "SYS" who is invoking the AQ notification call back method, "Mypackage.SP_Callback".
    Do i have any settings so that "Mypackage.SP_Callback" is called with a specific user account instead of "SYS".
    Please help me...
    Edited by: user13421038 on Jun 30, 2011 5:06 AM

    Hello,
    From what is mentioned in this thread this issue is the same as that discussed in Note 552771.1. The issue should be resolved in 10.2.0.4 and 11.1.0.6 onwards.
    Thanks
    Peter

  • Queue with callback function not dequeuing

    Hi,
    I would like to ask you for help or for a hint regarding our problem with the queue:
    A trigger is enqueuing to a queue. This works fine, but the callback function is never called. The queue already worked for a while, but since i changed something at the procedure called by the callback it does not work anymore.
    I already have tried the following:
    -Stopping and restarting
    -Dropping and recreating (with the scheduler having no jobs anymore)
    -Dropping, restarting the database and recreating
    None of these worked. Where do I fail, when considering that the queue with the same scripts worked already? I post the script for creating the queue and adding the subscriber:
    CREATE OR REPLACE TYPE pat_history_queue_payload_type AS OBJECT
    ( TSTAMP VARCHAR2(22 CHAR),
    TYP VARCHAR2(10 CHAR),
    DELTA_MENGE NUMBER,
    ORIGIN VARCHAR2(1 CHAR),
    TEXT VARCHAR2(1000 CHAR),
    QL_TSTAMP VARCHAR2(22 CHAR)
    BEGIN
    DBMS_AQADM.CREATE_QUEUE_TABLE (
    queue_table => 'pat_history_queue_table',
    queue_payload_type => 'pat_history_queue_payload_type',
    multiple_consumers => TRUE
    END;
    BEGIN
    DBMS_AQADM.CREATE_QUEUE (
    queue_name => 'pat_history_queue',
    queue_table => 'pat_history_queue_table',
    max_retries => 10
    DBMS_AQADM.START_QUEUE (
    queue_name => 'pat_history_queue'
    END;
    BEGIN
    DBMS_AQADM.ADD_SUBSCRIBER (
    queue_name => 'pat_history_queue',
    subscriber => SYS.AQ$_AGENT(
    'pat_history_queue_subscriber',
    NULL,
    NULL )
    DBMS_AQ.REGISTER (
    SYS.AQ$_REG_INFO_LIST(
    SYS.AQ$_REG_INFO(
    'pat_history_queue:pat_history_queue_subscriber',
    DBMS_AQ.NAMESPACE_AQ,
    'plsql://PAT.HISTORY_QUEUE_DISTRIBUTION.CALLBACK',
    HEXTORAW('FF')
    1
    END;
    The function CALLBACK which is called by the queue, is never called, I checked that with log messages. Also the package that contains the function is compiled ok.
    Thanks.
    Roland

    Hi,
    Does the subscription show up correct in sys.reg$ ?
    Regards,
    Harry
    http://dbaharrison.blogspot.com/

  • JNI Multithreading/Callback Function Design Issues

    Ok, I have been working on this for quite some time now and I simply can not figure it out. So any ideas are more than welcome. :)
    I have Java code that uses a DLL that I created in C++. My C++ code links with a library made by a 3rd party (don't have access to the source or anything). The 3rd party's code creates a new thread and calls a callback function that I define in my C++ code. This callback is called continuously until I perform some other code to stop it. Now for the tricky part. In my callback function I need to pass some data back in Java. Here is where my design falls apart. Since the callback function is technically part of the 3rd party's thread, I have to call AttachCurrentThread() in the callback to get the JNIEnv pointer in order to ultimately call my desired Java method. The problem is that my Java method (or even the C++ callback function) are only invoked if I do a sleep() in my C++ code after I start the 3rd party code which creates the thread. If I do a Thread.sleep() in Java after I call the native function code, it just sleeps and the callbacks never get called. It appears as though the thread dies as soon as I return from my C++ code.
    So now I am stuck. I have tried creating a thread in Java which simply calls the C++ code and the C++ code just loops waiting for an updated flag, however, this causes the 3rd party's thread creation code to fail (not quite sure why). However, even if their code worked, I'm not convinced this is even proper design. I apologize if this is simply a threading design principle as my multithreading programming techniques are a bit rusty and I've never done a multithreaded application this complex (this is a simplified version, but the idea is the same).
    I welcome any suggestions or even documentation that may lead me in the right direction. Thanks in advance.

    I have a similar issue.
    from java I call a dll I wrote, which calls a third party scanner dll (cyber.dll). Everything works ok, except, when an event in the scanner occurs, it calls the call backin my dll, which calls the callback in java, which kills the vm with an access violation. If I execute the call back to java from a c method which I just called from java, it works, but if it gets called outside of the java execution of the native code, it fails.
    I havent done anything with treads or syncronisation. Do I need to do this AttachCurrentThread stuff? If so, where do I get the _jvm handle as Im not starting the vm from c?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • ProcessSystemEvents & callback functions

    Hello.
    I have a question about the ProcessSystemEvents() and callback functions. If I have the following "strange" callback function with the follwoing code inside:
    int func(...) {
      while(true) {
       ProcessSystemEvents();
    Could this code create a crash in the underlying run-time lib (cvirte.dll etc), with to many calls to ProcessSystemEvents?
    And will this code stop any other callback function from execution, since we are in an infinite while loop?
    Best regards,
    Christian G.

    A fuction like that should be called only once, if this is what you intend. While sitting in the loop, ProcessSystemEvents permits the system to react to events like the user pressing a button or something like this. You must explicitly avoid dangerous events like calling the function again and again, as well as all user actions that can cause problems (like modifying critical parameters while the function is running, improperly exiting the program and so on). To obtain this you may either disable unwanted buttons on the GUI or set a global flag 'system running' tested on all callbacks and functions to protect the system from unwanted operations.
    Proud to use LW/CVI from 3.1 on.
    My contributions to the Developer Zone Community
    If I have helped you, why not giving me a kudos?

Maybe you are looking for