SAK
SAK

Reputation: 169

Visual Studio, c++: run main() in dll?

I'm building a .dll application in Visual Studio with C++. I'd like to be able to run some test code (using main() and std::cout) to the console as I write to ensure that the code actually does what it's supposed to do.

But apparently, you can only build a .dll application and not run it.

Surely there's gotta be a way around this?

Upvotes: 0

Views: 123

Answers (1)

Matthieu Brucher
Matthieu Brucher

Reputation: 22023

Write a test driver, a real application (a dll is not an application, it's a library), that will link against your dll and that will execute your tests.

That's the usual pattern as well for Boost.test, GoogleTest and many others unit test frameworks.

(that's a big hint to use a unit test framework for what you are doing)

Upvotes: 2

Related Questions