Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

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

12 views
Skip to first unread message

xmllmx

unread,
May 26, 2012, 4:05:12 PM5/26/12
to
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!
0 new messages