Here's a picture
Build C dll three ways based on a #define
I have a C dll in a Visual Studio project that contains #define LEVEL taking value 0, 1, or 2. I build the dll one of these three ways and run a VB program that uses it. All of that works fine.
What I would like to do is build the dll all three ways from Visual Studio. I want to edit my source files and change dll project properties, and then build the 3 dlls respecting all changes. The 3 builds should be identical except for the value of the #define and the name and/or location of the output .dll file.
I don't see a simple way to do this. Any ideas?
-
David Lowndes 4,711 Reputation points
2020-09-26T16:26:19.643+00:00
4 additional answers
Sort by: Most helpful
-
David Lowndes 4,711 Reputation points
2020-09-26T15:56:47.417+00:00 Create different build configurations. Use Build, Configuration Manager, select the project configuration combo box - and there you can create alternate configurations with different settings.
-
Andy 41 Reputation points
2020-09-26T16:16:00.467+00:00 Under Build, Configuration Manager, I don't see a project configuration combo box.
I see active solution configuration, active solution platform, and project contexts.
My only config is Release, my only platform is x64, and everything looks correct.
I'm running VS 2017 community edition - is that a problem? -
Andy 41 Reputation points
2020-09-26T17:39:04.62+00:00 I'm most of the way there. I've defined configs Level1 and Level2. Each defines preprocessor variables and properly builds dlls in their own directories. So, with Release, Level1, and Level2, I have my three dlls.
Level1 and Level2 inherit properties from Release. If I change a property in the Release configuration, will it apply to Level1 and Level2? Or have I opened the can of worms of keeping three sets of properties in sync?
Is there a way to build all configurations at once?
-
Andy 41 Reputation points
2020-09-26T20:30:10.563+00:00 I think I've got it all, I'll post a new issue in a day or so if further problem in this area. But I think I see it all now. In the past, all I did was a couple of release executables and mostly compiled and ran in the ide in debug mode. Little experience with more complex build questions. Thanks a million!