Page 1 of 1

How to switch between static and dynamic link?

Posted: Sat Aug 10, 2019 12:04 pm
by vjedlicka
On Windows, using VS 2017, how do I switch between static and dynamic linking of my app?
Thanks!
Vaclav

Re: How to switch between static and dynamic link?

Posted: Sat Aug 10, 2019 1:03 pm
by PB
It depends on which configuration you are switching from/to.

The basic differences are just two:
  1. If you are using the dynamic build, WXUSINGDLL must be defined in your application project in C/C++ / Preprocessor / Preprocessor Definitions.
  2. The dynamic libraries are in $(WXWIN)/lib/vc_dll while the static ones are in $(WXWIN)/lib/vc_lib. You need to change the directories accordingly in Linker / General / Additional Library Directories. If you do not use MSVC autolinking (via including $(WXWIN)\include\msvc) you also need to changer the configuration specific include folder listed as the first in C/C++ / General / Additional Include Directories, which would be e.g. $(WXWIN)\lib\vc_dll\mswud for the dynamic debug build.
Obviously, if you are using the dynamic build, all the necessary DLLs must be available to the executable at the run time, i.e., generally be in the same folder as the program. And also obviously, you must have built wxWidgets in the required build.

Re: How to switch between static and dynamic link?

Posted: Tue Aug 13, 2019 4:03 pm
by vjedlicka
ok, so the samples provided with wxWidgets are pre-configured for static build right?
(the hey the vc.lib in Linker/General/Additional...)

Re: How to switch between static and dynamic link?

Posted: Tue Aug 13, 2019 6:27 pm
by PB
wxWidgets MSVC solutions contain multiple configurations. Configurations named Debug and Release are static; configurations named DLL Debug and DLL Release use DLLs.

Re: How to switch between static and dynamic link?

Posted: Tue Aug 13, 2019 6:31 pm
by ONEEYEMAN
Hi,
By default MSVC solution files will build statically linked wxWidgets libraries and produces statically linked samples.
However you can change it for the samples, if you did build the library as DLL Debug/Release.

Thank you.

Re: How to switch between static and dynamic link?

Posted: Tue Aug 13, 2019 8:00 pm
by vjedlicka
Thank you
Vaclav