×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Oct 2007
    Posts
    14

    Exception when C++ function call C function

    My program is C++ code call C code,when exception(eg, null pointer ,array out of bandery) happened,what should I Do?
    I try to used TRAPD(err, fun()); method ,But Not any exception
    was catched . wether I used that not correct?
    Does symbian has (ECH )"_try _execption" method to catch the exception that programer need not to throw execption at all?

    I hope someone can help me!

  2. #2
    Registered User
    Join Date
    Jan 2004
    Posts
    44

    Re: Exception when C++ function call C function

    Symbian has its own exception handling system (the TRAP macro you mentioned). It also has its own exceptions, so you can't use C++ exceptions here. For example:

    ..
    TRAPD(err, funL()); //Exception "catching"
    if(err == KErrNone){..} //Exception handling
    else{..}
    ..

    void Something::funL() //the function that can "throw" an exception
    {
    ..
    if(somethingterrible)
    {
    User::Leave( reasoncode ); //SYMBIAN EXCEPTION ("throw")
    }
    ..
    }

    If a function may leave (throw an exception), it has to have an 'L' at the end of its name.
    I'm not sure if this answers your question... I hope it does.

  3. #3
    Regular Contributor
    Join Date
    Mar 2006
    Posts
    280

    Re: Exception when C++ function call C function

    http://wiki.forum.nokia.com/index.ph..._in_Symbian_OS
    http://wiki.forum.nokia.com/index.php/Panic
    http://wiki.forum.nokia.com/index.ph...ulltext=Search

    Understand the difference between a Panic and a Leave (sometimes, in some versions AKA Exception).

  4. #4
    Registered User
    Join Date
    Oct 2007
    Posts
    14

    Re: Exception when C++ function call C function

    "_try _execption" not need programer trow execption

    when the excepiton happend ,it can catch Mainly part of

    execption . I need the method that programer not need

    throw

  5. #5
    Regular Contributor
    Join Date
    Mar 2006
    Posts
    280

    Re: Exception when C++ function call C function

    You could try User::SetExceptionHandler(), but you need to understand the difference between exceptions and panics as I said in the last post.

Similar Threads

  1. i got Exception when i call the high level screen from the canvas screen using comman
    By madnan_java in forum Mobile Java Media (Graphics & Sounds)
    Replies: 0
    Last Post: 2004-10-05, 13:50
  2. How to call nonexported virtual function
    By zhang_guoqing in forum Symbian
    Replies: 0
    Last Post: 2004-07-26, 08:23
  3. can not successfully link any sample using .NET
    By lobotomat in forum Symbian Tools & SDKs
    Replies: 2
    Last Post: 2002-08-20, 00:29
  4. Call function - Direct from card
    By Nokia_Archive in forum Browsing and Mark-ups
    Replies: 0
    Last Post: 2002-05-16, 13:29
  5. Problem with Nokia D211 Linux Drivers
    By fiveam in forum Multimodecards
    Replies: 1
    Last Post: 1970-01-01, 02:00

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×