Skip to main content
gamedev.net
🔒 Locked

Proper libraries (.lib)

Started by Hassanbasil 8 replies 800+ views
Original Post
Hassanbasil
Hassanbasil
Hello everyone,

This is my first time creating a library (.lib file), but i'm getting some annoying issue when using it, for example, if i call a function that is defined inside the lib from somewhere outside the lib, and the function triggers an exception, VC opens the library's source code to point out where the exception happened, this is not supposed to happen is it? usually, when i use libs created by others, and an unhandled exception happens for whatever reason, VC points to the function that triggered the exception outside the lib, and doesn't open the lib itself, so how can i prevent this from happening?

Thanks for your time
-Hassan
Nanoha
Nanoha
if you build is as debug then it may do that. Is this release configuration or debug?
Interested in Fractals? Check out my App, Fractal Scout, free on the Google Play store.
Hassanbasil
Hassanbasil
Quote:
Original post by Nanoha
if you build is as debug then it may do that. Is this release configuration or debug?


well both, i made two versions of the library, a debug version and release version, so projects with debug options uses the debug library, and release projects use the release library

Well here's what happens:
using the debug library (project config:debug), the lib opens when an exception happens, that is very unwanted

using the release library (project config:release), neither the lib opens nor the project, another file opens that is not mine (memory stuff etc), not very unwanted
ApochPiQ
ApochPiQ
Why is this a problem? Just use the Call Stack window to walk back up the chain of function calls that led into the library, and you'll see the code from your client program that triggered the exception.
Hodgman
Hodgman
When you compile the library, you can choose whether it generates debug information (such as a PDF file) or not. If you don't generate this extra info, then the IDE will do what you're asking for (halt in the user-code, not the library-code).
Hassanbasil
Hassanbasil
Quote:
Original post by ApochPiQ
Why is this a problem? Just use the Call Stack window to walk back up the chain of function calls that led into the library, and you'll see the code from your client program that triggered the exception.


Well, you probably don't want the library user to be able to see it's source code, otherwise why are you using a library?

Quote:
Original post by Hodgman
When you compile the library, you can choose whether it generates debug information (such as a PDF file) or not. If you don't generate this extra info, then the IDE will do what you're asking for (halt in the user-code, not the library-code).


I see, well where can i choose the option not to generate debug info?
Hodgman
Hodgman
Quote:
Original post by Hassanbasil
you probably don't want the library user to be able to see it's source code, otherwise why are you using a library?
That depends on how much you trust the people you're selling/licensing the library to. At work, we would very rarely purchase a library if it didn't come with the source code to it.
Quote:
I see, well where can i choose the option not to generate debug info?
In Visual Studio, there should be a "debug information format" option somewhere under the "C/C++" section of your project properties, set that option to "disabled".
Hassanbasil
Hassanbasil
I actually want it to be private, i dont know why people here (especially on THIS board -general programming-) always argue about minor things like this, seriously, if i wanted it to be open source i wouldn't have asked in the first place..(no offense)

Thanks Hodgman, that works!
Evil Steve
Evil Steve
Does it not default to disabled in release mode? If so, why are you distributing a debug version of the library?

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.