CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Oct 2008
    Posts
    6

    HELL DLL in release mode

    I am not able to do a dll working in release mode. I have written a function in VC++ to be called from VBA. When configured in debug mode everything is OK, i can debug the dll perfectly . Even when configured in release mode i can compile and debug the dll. However, when i call the dll (with no debug options), handling the dll path to VBA i get all my Excel workbooks closed with no clue of what is happening underneath. I have read some stuff about compiling under release mode, and according to it i have debugged all the warnings....etc. I am driving crazy because the more things i do more depressed i feel!!

    Please, any clue??

  2. #2
    Join Date
    Mar 2001
    Posts
    2,529

    Re: HELL DLL in release mode

    What you will need to do is debug this dll in relase mode. In other words turn on debug in formation. I believe that you will need to turn on program database. Now you will need to debug your dll from a C++ client exe, not a VB Client. That way you can step right into your dll code from your C++ client app.

    Make sure that you have NDEBUG, not _DEBUG in your preprocessor definitions and that you are infact in the release build when you are debugging release build, because otherwise the code will not behave as planned.

    In debug mode, memory allocation is much more permissive, and the code runs more slowly. This allows for errors to slip through.

    Here is an article on debugging release mode from MSDN:

    http://msdn.microsoft.com/en-us/libr...zz(VS.71).aspx

    Hope To Help,
    ahoodin
    To keep the plot moving, that's why.

  3. #3
    Join Date
    Oct 2008
    Posts
    6

    Re: HELL DLL in release mode

    Thanks ahoodin for your reply!!
    I have debugged the dll in release mode as you said. I have done so both with the Optimization option disabled and the Maximize speed option, and the dll runs perfectly.. However, i get the same problem when calling the dll built in release mode with no debug options. Curiously or not , in contrast to what happens when debugging with Optimization disabled, when debugging with the Optimization option "Maximize Speed" there a few functions where i can not set a breakpoint , though i can not find why..

    Tx a lot..

  4. #4
    Join Date
    Mar 2001
    Posts
    2,529

    Re: HELL DLL in release mode

    If you fail to debug in release mode, I suggest sending strings to a serial port. These strings can be peppered through your code to let you know where in your code you are and what is happening. They should be informational. If you don't go this route, make a log and write it to file of the same informational messages you would be sending to the serial port. You will have to come up with a set of contrived tests so you know exactly what went on in your code when looking at your logs.
    ahoodin
    To keep the plot moving, that's why.

  5. #5
    Join Date
    Feb 2002
    Posts
    4,640

    Re: HELL DLL in release mode

    Quote Originally Posted by ferdelo View Post
    Thanks ahoodin for your reply!!
    I have debugged the dll in release mode as you said. I have done so both with the Optimization option disabled and the Maximize speed option, and the dll runs perfectly.. However, i get the same problem when calling the dll built in release mode with no debug options. Curiously or not , in contrast to what happens when debugging with Optimization disabled, when debugging with the Optimization option "Maximize Speed" there a few functions where i can not set a breakpoint , though i can not find why..

    Tx a lot..
    In release mode, the compiler may (okay, will) optimize the code, such that those lines are no longer "there" in the code. Inline functions are a good example of this. You can set a breakpoint on inline functions in debug mode, because the compiler will not inline them. However, in release mode, they are inlined and not really "there" in your source code. Well, they are there, just not at that exact point.

    Viggy

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