What does adding a module definition file via target_sources do?

It kind of has to do something for symbol exporting because it’s just a part of the Windows object file format used by the runtime loader. From this SO answer, it looks like there is dlltool which does the .def file work. This is part of the Windows “binutils” and isn’t necessarily part of the toolchain (just like the Linux linker ld is not of any given toolchain; these things are much more “platform”-specified). I do see references in the GCC codebase to dlltool, so presumably any .def file support is done by passing it onto the linker implementation.

1 Like