CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Threaded View

  1. #1
    Join Date
    Mar 2009
    Posts
    2

    Question try catch(...) problem in VC++

    Hello everyone,

    I have a VS solution with a C# windows application and a VC++ dll which exports a function.
    In that function (from the dll) I have a try catch block like this:
    try{
    //do something
    int a =0;
    int b = 100/a;
    //do something else
    catch(...)
    {
    //Log this exception
    }

    the prblem is that the exception is caught from the C# application. The dll (which exports a function) is imported in the C# application like this:

    [DllImport("Huffman", EntryPoint = "StartToArchive")]
    private static extern void StartToArchive(string from, string to, StatusCallBackDelegate statusCallback);

    Do you have any ideas how can the exception (error division by 0) can be managed by the try catch block from the C++ dll without throwing an error in C#?

    This code is just an example. I don't look for answers like test before the third line if a != 0.

    The C++ dll is unmanaged code.
    Last edited by lunguIonut; March 13th, 2009 at 05:21 AM. Reason: Forgot to say.

Tags for this Thread

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured