How do I rename a DLL but still allow the EXE to find it?

后端 未结 6 1940
难免孤独
难免孤独 2020-12-24 14:14

We have a DLL which is produced in house, and for which we have the associated static LIB of stubs.

We also have an EXE which uses this DLL using the simple method o

6条回答
  •  Happy的楠姐
    2020-12-24 14:49

    Using the LIB tool (included with visual studio) you can generate a lib file from a def file. Asuming your dll source does not include a def file, you have to create one first. You can use dumpbin to assist you. For example: dumpbin /exports ws2_32.dll

    In the output you see the names of the functions exported. Now create a def file like this:

    LIBRARY WS2_32
    EXPORTS
        accept      @1
        bind        @2
        closesocket @3
        connect     @4
    

    The @number is the ordinal in the dumpbin output

    Use LIB /MACHINE:x86 /def:ws2_32.def to generete the lib file.

    Now you can easily modify the def file, and generate a new libfile each time you rename your dll.

    you can verify the libfile using dumpbin: dumpbin /exports ws2_32.lib. You should get the same output as the original lib file.

提交回复
热议问题