Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Export for DLL #515

Closed
Darelbi opened this issue Oct 13, 2015 · 5 comments
Closed

Feature Request: Export for DLL #515

Darelbi opened this issue Oct 13, 2015 · 5 comments

Comments

@Darelbi
Copy link

Darelbi commented Oct 13, 2015

What about adding a EXPORT MACRO inside catch?

Actually with GCC/CLANG I can just CATCH_CONFIG_MAIN inside a DLL and link with executables. However the same is not possible with visual studio because it insist to say that "libCatch.lib" cannot be opened. (I'm using Cmake to automate most stuff, after investigation I found that's the error for missing exported symbols). The problem is fixed using Catch as static library, however the static library means instead of getting many executables of 170 Kb, I get many executables of ~1MB, wich could become an issue If later I have hundreds test files.

I want to be able to define a CATCH_EXPORT macro or something similiar beside CATCH_CONFIG_MAIN so I can use shared library also with visual studio.

The use case scenario is.

1 Catch.dll
Many test executables (each one separately linked and runeed against the DLL).

Possibly I want just to compile the following file to get the DLL (right know I think Catch just deduces Import/export settings assuming all test cases are linked togheter into 1 executable, however that has the serious problem that if 1 test fail CMake execution of tests will interrupt, while with my current setup all tests are runned indipendently of wich fails)

Catch.cpp

#define CATCH_CONFIG_MAIN
#define CATCH_EXPORT
#include "Catch.hpp"
@fschuh
Copy link

fschuh commented Jun 26, 2018

Any updates on this feature request?
This would be very nice to have, my use case also involves test code spread across multiple DLLs.

@jwuttke
Copy link

jwuttke commented Dec 19, 2019

Must have; otherwise catch2 does not qualify for cross-platform development

@randaz81
Copy link

ping

@jwuttke
Copy link

jwuttke commented Jan 24, 2023

Martin, that link only says you won't support DLLs under Windows. Why not? Little change to your code, big gain in usability!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants