CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: LNK2001 error

Threaded View

  1. #1

    LNK2001 error

    My 32-bit DLL needs to call a 16-bit DLL ReadSize16.dll and
    I get the linking error:
    error LNK2001: unresolved external symbol "int __stdcall _ReadSize(unsigned char, unsigned char *, unsigned long)" (?ReadSize@@YGHEPAEK@Z)
    fatal error LNK1120: 1 unresolved externals

    What am I missing?

    My 32-bit DLL code is below:

    //--------------------------------------------------------------------
    #include <windows.h>

    // Prototype for function in 16-bit DLL
    BOOL FAR PASCAL ReadSize(BYTE bDrive, LPBYTE lpBuffer, DWORD cbBuffSize);

    __declspec(dllexport) BOOL WINAPI CallReadSize()
    {
    HMODULE hModule;
    char lpBuff[512];
    BOOL fResult;

    if ((hModule=LoadLibrary("ReadSize16.dll")) == NULL)
    return 5; // DLL load error

    if (GetProcAddress(hModule, "ReadSize") == NULL)
    return 6; // DLL function call error

    if (fResult=ReadSize(0x80, (LPBYTE)lpBuff, 512)) {
    .......
    }

    return fResult;
    }
    Last edited by Kurosan; November 21st, 2003 at 03:50 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured