Skip to content

Static linking and "DllMain" #5366

@theoractice

Description

@theoractice

Back in 2016, when I tried to fix the static linking issue of OpenBLAS (#813), I did not make any changes to the DllMain function, because as a newcomer, I was not sure how DllMain was being used in the project.

Recently, when I tried to use OpenBLAS together with the VC-LTL library to make my program run on Win7/XP, I encountered this:

error LNK2005: DllMain already defined in openblas.lib(memory.obj)

I've noticed that similar issues have appeared many times both on the web and in this repo. As I read this part of the code again, an idea I had back then came to me once more: when building as static library, should we give DllMain another name, such as StaticLibMain (as we all know, it is not preferred to have a DllMain symbol in a static library)? In this way, it wouldn't affect the TLS callback logic at all, and the linking problem can be avoided.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions