can't include _alloca as an intrinsic function

M

mousou

Hi all,

I trying to port a WDM driver in VS.Net 2005. I had several difficulty,
but it's one of them I still did not found any solutions.

My code use the function _alloca to allocate space on the stack. When I
compile my code with the include of <malloc.h> I have no problem but
the difficulty raise with the linker:
error LNK2019: unresolved external symbol __alloca_probe_16 referenced
in function "long __stdcall CreateRegistryPath(void * &,char const
*,unsigned long)" (?CreateRegistryPath@@YGJAAPAXPBDK@Z) drvutils.obj

It seems that the new Multithreaded runtime of VC8 doesn't contains
this function...

So I have try to use compiler intrinsic version by adding /Oi to
compiler option and removing the #include <malloc.h>
I have a compiler error now:
error C3861: '_alloca': identifier not
found d:\Dev\Sp07-1\XSp\_scc\VirtualAudioCable\Originals\VAC\drvutils.cpp 1630

However _alloca is declared as available on all platform :
http://msdn2.microsoft.com/en-us/library/5704bbxw.aspx
 
M

Michael Phillips, Jr.

So I have try to use compiler intrinsic version by adding /Oi to
compiler option and removing the #include <malloc.h>
I have a compiler error now:
error C3861: '_alloca': identifier not
found d:\Dev\Sp07-1\XSp\_scc\VirtualAudioCable\Originals\VAC\drvutils.cpp
1630

Did you try replacing the following line:
#include <malloc.h>

with this include?:
#include <intrin.h>
 
M

mousou

Hi Michael,

I also try this option but it contains only function definition and I
still have the error at link.

This function should be [part of the compiler and it's not the case,
the only way to eliminate this error is to include library msvcrt.lib
or libcmt.lib. Which are conflicting with some of my driver
declaration. I have open a support request at Microsoft. I'm currious
to know what there propose.
 
B

Bruno van Dooren [MVP VC++]

This function should be [part of the compiler and it's not the case,
the only way to eliminate this error is to include library msvcrt.lib
or libcmt.lib. Which are conflicting with some of my driver
declaration. I have open a support request at Microsoft. I'm currious
to know what there propose.

Hi, you should ask this question in development.device.drivers, or in the
NTDEV group on www.osronline.com
That is there device driver experts hang out.

Btw, I hope you are not using the VC2005 compiler because you will not get
support.
Microsoft only supports you when building device drivers using the DDK. If
you use VC2005 you are on your own.

Device driver experts are also unlikely to (want to) help you, because as a
rule, they really hate it when you use a non-standard build environment. It
can to introduce subtle differences in behavior.

--

Kind regards,
Bruno van Dooren
(e-mail address removed)
Remove only "_nos_pam"
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top