Skip to content

Error LNK2001: unresolved external symbol __imp__LM_FindModule #291

@theberrigan

Description

@theberrigan

I'm trying to create my own 32-bit DLL using static version of libmem-5.1.0 (without external libmem.dll), but every time I try to build the project a linking error appears:

dllmain.obj : error LNK2001: unresolved external symbol __imp__LM_FindModule
C:\Projects\CPPProjects\libmem-test\Release\libmem-test.dll : fatal error LNK1120: 1 unresolved externals

Reproduction steps:

  1. Clone repo: https://github.com/theberrigan/libmem-test
    About project:
  2. Open libmem-test.sln in Visual Studio.
  3. Select Configuration "Release" and Platform "Win32".
  4. Build project libmem-test.
  5. The error described above will appear.

Project builds without errors with the shared version of libmem, but I need the static version.
Also I found this issue, but this is not exactly my case.

What I did:

  • I tried to build the lib with default configuration according to build docs (using nmake).
  • I tried to build it like this:
    cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -DLIBMEM_ARCH=i386 -DLIBMEM_BUILD_STATIC=1
    nmake
    
  • I tried to create a solution for VS2022 using Cmake GUI and build project with it.
  • I tried different Runtime Libraries (/MT, /MTd, /MD, /MDd)

Versions:

  • Windows 10 Pro 10.0.19045 build 19045 (22H2)
  • Windows SDK 10.0.26100.0 (matches the WINSDK version from libmem 5.1.0 release)
  • MSVC 14.44.35207 (matches the MSVC version from libmem 5.1.0 release)
  • MS Build Tools 17.14.23.42201
  • VS2022 17.14.18

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions