apply plugin: 'cpp' // tag::apply-plugin[] apply plugin: 'windows-resources' // end::apply-plugin[] model { components { hello(NativeLibrarySpec) main(NativeExecutableSpec) { sources { cpp { lib library: 'hello' } } } } binaries { all { linker.args "user32.lib" } // For any shared library binaries built with Visual C++, define the DLL_EXPORT macro withType(SharedLibraryBinarySpec) { if (toolChain in VisualCpp) { cppCompiler.define "DLL_EXPORT" } } } }