Is memcmp an unsolved symbol in NT kernel driver even if compiledwith /Oi?

Discussion in 'Windows Vista Drivers' started by xmllmx, May 26, 2012.

  1. xmllmx

    xmllmx Guest

    Code Sample 1:

    #include <ntifs.h>

    NTSTATUS DriverEntry(PDRIVER_OBJECT param1, PUNICODE_STRING param2)
    {
    char s1[] = "Hello";
    char s2[] = "World";

    int n = memcmp(s1, s2, 5);

    return 0;
    }

    WDK compiler reports: error LNK2019: unsolved extern symbol _memcmp referenced in function _DriverEntry@8

    However, if I modify a bit the code as follows, then the compiler will accept it.

    Code Sample 2:

    #include <ntifs.h>

    NTSTATUS DriverEntry(PDRIVER_OBJECT param1, PUNICODE_STRING param2)
    {
    char s1[] = "Hello";
    char s2[] = "World";

    memcmp(s1, s2, 5);

    return 0;
    }

    Why?

    Thanks in advance!
     
    xmllmx, May 26, 2012
    #1
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.