I am trying to create a driver using WDK.I need to use malloc in that driver.When I try to use that I got an error like malloc unresolved external symbol.I think that I have to include some library.But I am not sure .How can I resolve this error?
Asked
Active
Viewed 5,041 times
1 Answers
9
Windows Device drivers don't normally link with the C-Runtime. The build environment for the DDK/WDK doesn't link with MSVCRT. But there are memory allocation routines that can be used in kernel and driver programming.
See this link for more details.
Side note:
I'm a bit worried that you did not mention that "free" was also an unresolved symbol. That suggests that you never call it, hence a memory leak in device driver code. ;) Or does the WDK pull in an implementation of free() from somewhere?

selbie
- 100,020
- 15
- 103
- 173
-
-
I have used MmAllocateNonCachedMemory to allocate memory.I forget to use Free .I do not know which function i have to use to free memory in driver programming .Can u guide me ?.I am new to driver programming. – raji Mar 16 '13 at 06:23
-
MmFreeNonCachedMemory - http://msdn.microsoft.com/en-us/library/windows/hardware/ff554516%28v=vs.85%29.aspx – selbie Mar 16 '13 at 07:01
-
:I am using MmAllocateNonCachedMemory and MmFreeNonCachedMemory its through exception .What type exception handling i have to use to catch that – raji Apr 14 '13 at 10:19
-