dangmoody / Temper

Single header-only testing framework written in C99.
MIT License
6 stars 1 forks source link

static library gets created with every exe using Tantrum #1

Closed dangmoody closed 3 years ago

dangmoody commented 3 years ago

Because of the fact that we're having to expose test functions via __declspec( dllexport ) a static library gets created automatically by the compiler. I'm not sure this is something we want. We load the game .exe into itself manually, so there's no need for the static library.

There might be a compiler flag to disable this behaviour, but I haven't checked.

This isn't priority because we still need to flesh out the rest of the library, but it's something that we'll probably want to fix come release.

Mike430 commented 3 years ago

Do we need to export the Tantrum header at all? We could just #include tantrum in any module that needs unit tests, and it's extremely rare in my experience that two testing modules need to know about / include one another.

This DOES potentially cause an issue with the logging we wish to add BUT - if our intention is to have people override the base log function then they can do that all of once in the source (not header) of their logging code and not have to export that. Right?

Just spit-balling

dangmoody commented 3 years ago

It's not the header that gets exported, it's the symbols for our test invoker functions.

My guess is that the compiler sees we're exporting functions in the binary (via __declspec( dllexport )) and then decides to generate a static library because it thinks we're trying to compile a DLL or something.

I don't think it's relevant to our logging system at all. I suspect the way people will override it is by doing something like the following:

#define TANTRUM_PRINTF( fmt, ... ) \
    /* make the call to my logging system here etc. */

// other defines that they'll override

#include <tantrum.h>

At least, that's how I see all the other header-only libraries override stuff like this.

I only bring this generated .lib file up as an issue because I don't think Temper should ever do that. The user will certainly never want to touch it.

dangmoody commented 3 years ago

This is not something that we as the library developers can control I don't think. This is a side-effect of how compilers produce DLLs and I'm pretty sure it would have to be the responsibility of the users to have their compiles not generate this.

I keep forgetting that changing something in our own build script sometimes means it reflects over to the user experience too.

Closing this.