Winelib _alloca/alloca linking problem

Vincent Béron vberon at
Tue Apr 15 18:47:25 CDT 2003

Ok, so this won't get into CVS (way too "hacked until it works for me 
and only me"), but I don't know where to look further.

Can somebody explain me where _alloca is supposed to be 
implemented/forwarded/ends up being called?

The provided small program should be able to compile with either _alloca 
or alloca being called. Under Winelib, with the current msvcrt headers, 
_alloca is not found at all and linking fails. With the included patch, 
the program runs.

Should I add a forward in msvcrt.spec from _alloca to MSVCRT_alloca, 
which itself calls (glibc's) alloca? Or is there something obvious I missed?

-------------- next part --------------
Index: wine/include/msvcrt/malloc.h
RCS file: /home/wine/wine/include/msvcrt/malloc.h,v
retrieving revision 1.5
diff -u -r1.5 malloc.h
--- wine/include/msvcrt/malloc.h	22 Mar 2003 21:15:41 -0000	1.5
+++ wine/include/msvcrt/malloc.h	15 Apr 2003 23:34:34 -0000
@@ -79,9 +79,6 @@
-static inline void* alloca(MSVCRT(size_t) i) { return _alloca(i); }
-#endif /* USE_MSVCRT_PREFIX */
+static inline void* _alloca(MSVCRT(size_t) i) { return alloca(i); }
 #endif /* __WINE_MALLOC_H */
-------------- next part --------------
#include <malloc.h>
#include <stdio.h>
#include <stdlib.h>

char *mp() {
	char *p;
	p = _alloca(2);
	p[0] = 0x41; /* A */
	p[1] = 0;
	return p;

int main(void) {
	char *p;
	p = mp();
	printf("%02x %02x\n", p[0], p[1]);
	return 0;

More information about the wine-devel mailing list