Bug 422185 - "jsgc.obj : error LNK2001: unresolved external symbol "int __cdecl posix_memalign(void * *,unsigned int,unsigned int)" (?posix_memalign@@YAHPAPAXII@Z)" (posix_memalign needs to be extern "C" when compiling with a C++ compiler) [p=benjamin@smedbergs.us (Benjamin Smedberg [bsmedberg]) r=brendan a1.9=damons]
authorreed@reedloden.com
Wed, 12 Mar 2008 15:32:54 -0700
changeset 12973 780c2a3a5c6cbe4f68fd334e6ae74014d85266c1
parent 12972 01abab9a2c914b12564bc71d6370e81aa06d3a6d
child 12974 9e9f0cabbc376442bc2d27eab24c208ef19f7f25
push idunknown
push userunknown
push dateunknown
reviewersbrendan
bugs422185
milestone1.9b5pre
Bug 422185 - "jsgc.obj : error LNK2001: unresolved external symbol "int __cdecl posix_memalign(void * *,unsigned int,unsigned int)" (?posix_memalign@@YAHPAPAXII@Z)" (posix_memalign needs to be extern "C" when compiling with a C++ compiler) [p=benjamin@smedbergs.us (Benjamin Smedberg [bsmedberg]) r=brendan a1.9=damons]
js/src/jsgc.c
--- a/js/src/jsgc.c
+++ b/js/src/jsgc.c
@@ -87,18 +87,20 @@
 # define HAS_POSIX_MEMALIGN 0
 #endif
 
 /*
  * jemalloc provides posix_memalign but the function has to be explicitly
  * declared on Windows.
  */
 #if HAS_POSIX_MEMALIGN && MOZ_MEMORY_WINDOWS
+JS_BEGIN_EXTERN_C
 extern int
 posix_memalign(void **memptr, size_t alignment, size_t size);
+JS_END_EXTERN_C
 #endif
 
 /*
  * Include the headers for mmap unless we have posix_memalign and do not
  * insist on mmap.
  */
 #if JS_GC_USE_MMAP || (!defined JS_GC_USE_MMAP && !HAS_POSIX_MEMALIGN)
 # if defined(XP_WIN)