none
error LNK2019: unresolved external symbol @InterlockedExchangeAdd@8 RRS feed

  • Question

  • Hi all,

    While building a driver using WDK7.1 for Windows XP, got the following error :

    error LNK2019: unresolved external symbol @InterlockedExchangeAdd@8.

    But using the same code , we can build for Windows 7 environment.

    Please help....

    Monday, February 4, 2013 10:38 AM

Answers

  • Thanks...

    we could solve the problem....

    added ntddk.h along with wdm.h...

    regards...

    Jayaram

    • Marked as answer by ram_89 Tuesday, February 5, 2013 9:45 AM
    Tuesday, February 5, 2013 9:45 AM

All replies

  • This function is probably in #ifdef section and is macro/inline in Windows XP and function in Windows 7 .h or the opposite... 
    Monday, February 4, 2013 2:03 PM
  • you might also have a calling convection problem. I think you have a decorated cdecl call above.

    d -- This posting is provided "AS IS" with no warranties, and confers no rights.

    Monday, February 4, 2013 6:01 PM
  • Thank you all..

    We are using WDK7.1 for building the driver.

    We can build the driver for Win7 x64 and Win7 IA64 environments.

    but build fails for Win7 x86 and Windows XP x86 with error:

    error LNK2019: unresolved external symbol @InterlockedExchangeAdd@8.

    But InterlockedExchangeAdd is defined in wdm.h and we have included this header file.

    Please help....

    Tuesday, February 5, 2013 6:29 AM
  • i have no idea how you are getting this error. as an experiment i opened an x86 win7 fre (and chk) build window and went to the echo sample and changed DriverEntry() to look like this

    {
        WDF_DRIVER_CONFIG config;
        NTSTATUS status;
        ULONG i=0;

        InterlockedExchangeAdd(&i, 5);

        [rest is the same]

    }

    and rebuilt sucessfully. i then looked at the imports and InterlockedExchangeAdd is not listed so clearly it can be used in an xp targeted build

    D:\WinDDK\7600.16385.1\src\general\echo\kmdf\DriverSync>link /dump /imports objre_wxp_x86\i386\echo.sys
    Microsoft (R) COFF/PE Dumper Version 9.00.30729.207
    Copyright (C) Microsoft Corporation.  All rights reserved.


    Dump of file objfre_wxp_x86\i386\echo.sys

    File Type: EXECUTABLE IMAGE

      Section contains the following imports:

        ntoskrnl.exe
                     10C94 Import Address Table
                     11ADC Import Name Table
                         0 time date stamp
                         0 Index of first forwarder reference

                      266 KeTickCount
                       41 ExAllocatePoolWithTag
                       4E ExFreePoolWithTag
                      5A9 memset
                      3C7 RtlCopyUnicodeString

        WDFLDR.SYS
                     10C80 Import Address Table
                     11AC8 Import Name Table
                         0 time date stamp
                         0 Index of first forwarder reference

                        7 WdfVersionBindClass
                        6 WdfVersionBind
                        8 WdfVersionUnbind
                        9 WdfVersionUnbindClass

    what does your sources file look like?


    d -- This posting is provided "AS IS" with no warranties, and confers no rights.

    Tuesday, February 5, 2013 6:50 AM
  • Thanks...

    we could solve the problem....

    added ntddk.h along with wdm.h...

    regards...

    Jayaram

    • Marked as answer by ram_89 Tuesday, February 5, 2013 9:45 AM
    Tuesday, February 5, 2013 9:45 AM