Sign in to follow this  
SteveDeFacto

Debugging a lib.

Recommended Posts

The only way I know to test and debug a lib is by putting the source files into an exe project. I have to test each function in the lib then to compile it I have to copy the source files to a lib project and compile it.

Is there another way to do it?

Share this post


Link to post
Share on other sites
If there's an application built with the lib, you can specify that application to be run for debugging purposes.

Or, you can run that application and then manually attach the debugger to it.

Or, if the LIB and the PDB are kept together, and you don't move your source files around, you can step into the functions from the library while debugging any application which links it.

Or, if the LIB project and the application which uses it are in the same solution and the application has the LIB as a dependency, all that stuff will just happen automatically.

Or, you can create a special test harness for the LIB to test it.

Share this post


Link to post
Share on other sites
Quote:
Original post by Sneftel
If there's an application built with the lib, you can specify that application to be run for debugging purposes.

Or, you can run that application and then manually attach the debugger to it.

Or, if the LIB and the PDB are kept together, and you don't move your source files around, you can step into the functions from the library while debugging any application which links it.

Or, if the LIB project and the application which uses it are in the same solution and the application has the LIB as a dependency, all that stuff will just happen automatically.

Or, you can create a special test harness for the LIB to test it.


What is this "test harness" you speak of?

Share this post


Link to post
Share on other sites
Visual Studio's built-in unit testing framework isn't suitable for use with unmanaged C++, but there are other unit testing frameworks which you can use. I've heard good things about VisualAssert (well, I've heard good things about cfix, on which VisualAssert is based), though I personally haven't used it.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this