#How to prevent generation of `_DllMainCRTStartup@12`

1 messages · Page 1 of 1 (latest)

grim rune
#

In empty DLL, with no function from me, there is still _DllMainCRTStartup@12 generated a an exported function, how do I prevent that?

left olive
#

i dont think you can prevent it, but you can override it with your own function if that would suffice

#
if (builtin.output_mode == .Lib and builtin.link_mode == .dynamic) {
            if (native_os == .windows and !@hasDecl(root, "_DllMainCRTStartup")) {
                @export(&_DllMainCRTStartup, .{ .name = "_DllMainCRTStartup" });
            }```

https://github.com/ziglang/zig/blob/master/lib/std/start.zig
GitHub

General-purpose programming language and toolchain for maintaining robust, optimal, and reusable software. - ziglang/zig

#

those are the conditions for when its generated

#

actually perhaps you could try adding a dummy function to your root source file

pub fn _DllMainCRTStartup() void {}
#

that should trigger the hasDecl check, but as long as you don't export it it shouldnt show up in the final binary

grim rune
#

That is a complication at best 😢