Exception in C Library from .Net built VC++ Application

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Venky

    Exception in C Library from .Net built VC++ Application

    We have a strange error here.
    We have an application that is built in VC++ 6.0 and uses a C library built
    using the same. Now, we have migrated to .Net and have used the same source
    code to be built using the new compiler.
    What happens now is, that any call that we make to the C library(also built
    in .Net Env now) from the VC++ Application(bui lt in .Net now), falls prey to
    a runtime exception and gets into our try catch block.
    We are having hard time to get this guy out.
    Any help will be appreciated.
    Regards
    Venky
  • David Levine

    #2
    Re: Exception in C Library from .Net built VC++ Application

    Perhaps if you supplied some details about the exception and the library
    someone could provide some help.

    "Venky" <Venky@discussi ons.microsoft.c om> wrote in message
    news:4834EB2D-CB61-4660-9AB3-C10CC29CB241@mi crosoft.com...[color=blue]
    > We have a strange error here.
    > We have an application that is built in VC++ 6.0 and uses a C library[/color]
    built[color=blue]
    > using the same. Now, we have migrated to .Net and have used the same[/color]
    source[color=blue]
    > code to be built using the new compiler.
    > What happens now is, that any call that we make to the C library(also[/color]
    built[color=blue]
    > in .Net Env now) from the VC++ Application(bui lt in .Net now), falls prey[/color]
    to[color=blue]
    > a runtime exception and gets into our try catch block.
    > We are having hard time to get this guy out.
    > Any help will be appreciated.
    > Regards
    > Venky[/color]


    Comment

    • Venky

      #3
      Re: Exception in C Library from .Net built VC++ Application

      Hi David,
      Thanks for your response. Unfortunately its our own C library and as on date
      I cannot reveal that for corporate rules.
      However, I can give you more information.
      Firstly, there is no specific exception code related to this.
      Guess what if I have the same library built using VC++ 6.0 it works OK, but
      when I build it with .Net it crashes.
      Any clues?
      Thanks
      Venky


      "David Levine" wrote:
      [color=blue]
      > Perhaps if you supplied some details about the exception and the library
      > someone could provide some help.
      >
      > "Venky" <Venky@discussi ons.microsoft.c om> wrote in message
      > news:4834EB2D-CB61-4660-9AB3-C10CC29CB241@mi crosoft.com...[color=green]
      > > We have a strange error here.
      > > We have an application that is built in VC++ 6.0 and uses a C library[/color]
      > built[color=green]
      > > using the same. Now, we have migrated to .Net and have used the same[/color]
      > source[color=green]
      > > code to be built using the new compiler.
      > > What happens now is, that any call that we make to the C library(also[/color]
      > built[color=green]
      > > in .Net Env now) from the VC++ Application(bui lt in .Net now), falls prey[/color]
      > to[color=green]
      > > a runtime exception and gets into our try catch block.
      > > We are having hard time to get this guy out.
      > > Any help will be appreciated.
      > > Regards
      > > Venky[/color]
      >
      >
      >[/color]

      Comment

      • David Levine

        #4
        Re: Exception in C Library from .Net built VC++ Application

        All you have told us is that something doesn't work without supplying any
        details at all, not even what the exception is. What do you expect anyone to
        do?

        "Venky" <Venky@discussi ons.microsoft.c om> wrote in message
        news:13CB1A7F-EDEB-42FE-BB1D-3666A26EC09C@mi crosoft.com...[color=blue]
        > Hi David,
        > Thanks for your response. Unfortunately its our own C library and as on[/color]
        date[color=blue]
        > I cannot reveal that for corporate rules.
        > However, I can give you more information.
        > Firstly, there is no specific exception code related to this.
        > Guess what if I have the same library built using VC++ 6.0 it works OK,[/color]
        but[color=blue]
        > when I build it with .Net it crashes.
        > Any clues?
        > Thanks
        > Venky
        >
        >
        > "David Levine" wrote:
        >[color=green]
        > > Perhaps if you supplied some details about the exception and the library
        > > someone could provide some help.
        > >
        > > "Venky" <Venky@discussi ons.microsoft.c om> wrote in message
        > > news:4834EB2D-CB61-4660-9AB3-C10CC29CB241@mi crosoft.com...[color=darkred]
        > > > We have a strange error here.
        > > > We have an application that is built in VC++ 6.0 and uses a C library[/color]
        > > built[color=darkred]
        > > > using the same. Now, we have migrated to .Net and have used the same[/color]
        > > source[color=darkred]
        > > > code to be built using the new compiler.
        > > > What happens now is, that any call that we make to the C library(also[/color]
        > > built[color=darkred]
        > > > in .Net Env now) from the VC++ Application(bui lt in .Net now), falls[/color][/color][/color]
        prey[color=blue][color=green]
        > > to[color=darkred]
        > > > a runtime exception and gets into our try catch block.
        > > > We are having hard time to get this guy out.
        > > > Any help will be appreciated.
        > > > Regards
        > > > Venky[/color]
        > >
        > >
        > >[/color][/color]


        Comment

        • DM McGowan II

          #5
          Re: Exception in C Library from .Net built VC++ Application

          Are you using a catch(...), just curious?

          Are you calling WIN32 GetLastError()?

          Are you getting it while in a debug session? If not try. If you can't then
          collecting runtime information about the call stack.

          There are many things you 'could' do as Mr. Levine pointed out.

          "David Levine" <noSpamdlevineN NTP2@wi.rr.com> wrote in message
          news:erdkyJIlEH A.3720@TK2MSFTN GP12.phx.gbl...[color=blue]
          > All you have told us is that something doesn't work without supplying any
          > details at all, not even what the exception is. What do you expect anyone
          > to
          > do?
          >
          > "Venky" <Venky@discussi ons.microsoft.c om> wrote in message
          > news:13CB1A7F-EDEB-42FE-BB1D-3666A26EC09C@mi crosoft.com...[color=green]
          >> Hi David,
          >> Thanks for your response. Unfortunately its our own C library and as on[/color]
          > date[color=green]
          >> I cannot reveal that for corporate rules.
          >> However, I can give you more information.
          >> Firstly, there is no specific exception code related to this.
          >> Guess what if I have the same library built using VC++ 6.0 it works OK,[/color]
          > but[color=green]
          >> when I build it with .Net it crashes.
          >> Any clues?
          >> Thanks
          >> Venky
          >>
          >>
          >> "David Levine" wrote:
          >>[color=darkred]
          >> > Perhaps if you supplied some details about the exception and the
          >> > library
          >> > someone could provide some help.
          >> >
          >> > "Venky" <Venky@discussi ons.microsoft.c om> wrote in message
          >> > news:4834EB2D-CB61-4660-9AB3-C10CC29CB241@mi crosoft.com...
          >> > > We have a strange error here.
          >> > > We have an application that is built in VC++ 6.0 and uses a C library
          >> > built
          >> > > using the same. Now, we have migrated to .Net and have used the same
          >> > source
          >> > > code to be built using the new compiler.
          >> > > What happens now is, that any call that we make to the C library(also
          >> > built
          >> > > in .Net Env now) from the VC++ Application(bui lt in .Net now), falls[/color][/color]
          > prey[color=green][color=darkred]
          >> > to
          >> > > a runtime exception and gets into our try catch block.
          >> > > We are having hard time to get this guy out.
          >> > > Any help will be appreciated.
          >> > > Regards
          >> > > Venky
          >> >
          >> >
          >> >[/color][/color]
          >
          >[/color]

          Comment

          • David Levine

            #6
            Re: Exception in C Library from .Net built VC++ Application

            This only happens with a release build?

            This sounds like a typical, difficult-to-debug unmanaged code problem. One
            approach you can try is to compile the release build with debugging symbols
            and load it up in a debugger. Set the debugger to break on 1st chance
            exceptions. If an exception is actually getting thrown in the C++ code it
            should break there. It may also be that the runtime is converting a return
            value into an exception. There are a thousand possibilities, but without
            more details it is impossible to say.


            "Venky" <Venky@discussi ons.microsoft.c om> wrote in message
            news:7576A6A4-A0D7-4E51-89EF-6286990D2D9E@mi crosoft.com...[color=blue]
            > I apologize. As I said this is a corporate code and I cannot reveal the
            > actuals. I know I am being very abstract and just defining a problem. My
            > curious hit was if someone else encountered a similar problem.
            > We are using catch(...). Inside this catch(...) even if I try to
            > GetLastError(), the only error code that I receive is 0. It does not[/color]
            happen[color=blue]
            > in a debug session, however let me explain you some more about the[/color]
            history.[color=blue]
            >
            > We had a C library called libdelta.lib, now we changed the directory
            > structure of this library and modified our vcproj file accordingly and it
            > builds. Also, we had this library as a static library in our application[/color]
            but[color=blue]
            > now its an import library that refers to libdelta.dll.
            >
            > Is there anything that this scenrio can derive?
            >
            > Many Thanks,
            > Venky
            >
            >
            > "DM McGowan II" wrote:
            >[color=green]
            > > Are you using a catch(...), just curious?
            > >
            > > Are you calling WIN32 GetLastError()?
            > >
            > > Are you getting it while in a debug session? If not try. If you can't[/color][/color]
            then[color=blue][color=green]
            > > collecting runtime information about the call stack.
            > >
            > > There are many things you 'could' do as Mr. Levine pointed out.
            > >
            > > "David Levine" <noSpamdlevineN NTP2@wi.rr.com> wrote in message
            > > news:erdkyJIlEH A.3720@TK2MSFTN GP12.phx.gbl...[color=darkred]
            > > > All you have told us is that something doesn't work without supplying[/color][/color][/color]
            any[color=blue][color=green][color=darkred]
            > > > details at all, not even what the exception is. What do you expect[/color][/color][/color]
            anyone[color=blue][color=green][color=darkred]
            > > > to
            > > > do?
            > > >
            > > > "Venky" <Venky@discussi ons.microsoft.c om> wrote in message
            > > > news:13CB1A7F-EDEB-42FE-BB1D-3666A26EC09C@mi crosoft.com...
            > > >> Hi David,
            > > >> Thanks for your response. Unfortunately its our own C library and as[/color][/color][/color]
            on[color=blue][color=green][color=darkred]
            > > > date
            > > >> I cannot reveal that for corporate rules.
            > > >> However, I can give you more information.
            > > >> Firstly, there is no specific exception code related to this.
            > > >> Guess what if I have the same library built using VC++ 6.0 it works[/color][/color][/color]
            OK,[color=blue][color=green][color=darkred]
            > > > but
            > > >> when I build it with .Net it crashes.
            > > >> Any clues?
            > > >> Thanks
            > > >> Venky
            > > >>
            > > >>
            > > >> "David Levine" wrote:
            > > >>
            > > >> > Perhaps if you supplied some details about the exception and the
            > > >> > library
            > > >> > someone could provide some help.
            > > >> >
            > > >> > "Venky" <Venky@discussi ons.microsoft.c om> wrote in message
            > > >> > news:4834EB2D-CB61-4660-9AB3-C10CC29CB241@mi crosoft.com...
            > > >> > > We have a strange error here.
            > > >> > > We have an application that is built in VC++ 6.0 and uses a C[/color][/color][/color]
            library[color=blue][color=green][color=darkred]
            > > >> > built
            > > >> > > using the same. Now, we have migrated to .Net and have used the[/color][/color][/color]
            same[color=blue][color=green][color=darkred]
            > > >> > source
            > > >> > > code to be built using the new compiler.
            > > >> > > What happens now is, that any call that we make to the C[/color][/color][/color]
            library(also[color=blue][color=green][color=darkred]
            > > >> > built
            > > >> > > in .Net Env now) from the VC++ Application(bui lt in .Net now),[/color][/color][/color]
            falls[color=blue][color=green][color=darkred]
            > > > prey
            > > >> > to
            > > >> > > a runtime exception and gets into our try catch block.
            > > >> > > We are having hard time to get this guy out.
            > > >> > > Any help will be appreciated.
            > > >> > > Regards
            > > >> > > Venky
            > > >> >
            > > >> >
            > > >> >
            > > >
            > > >[/color]
            > >
            > >[/color]
            >[/color]


            Comment

            Working...