From: Felix Natter Newsgroups: comp.os.msdos.djgpp Subject: Re: xmalloc and xfree Date: 10 Oct 1999 14:05:15 +0200 Organization: Customer of NDH Netzwerkdienste Hoeger GmbH Lines: 61 Message-ID: References: <199910101551 DOT JAA13611 AT lakdiva DOT slt DOT lk> NNTP-Posting-Host: port199.bonn.ndh.net Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: passat.ndh.net 939564313 14195 195.94.93.199 (10 Oct 1999 14:05:13 GMT) X-Complaints-To: abuse AT ndh DOT net NNTP-Posting-Date: 10 Oct 1999 14:05:13 GMT User-Agent: Gnus/5.070084 (Pterodactyl Gnus v0.84) Emacs/20.4 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com "Kalum Somaratna" writes: > Hi Felix, > The header file wich contain's the definition is stdlib.h as > documented in the doc's. > > #include > void *xmalloc(size_t size); > > It is strange that you got the messages. I compiled your program > and it linked without any problems and I also didn't get any > undefined reference's. did you also not get any warnings like "implicit declaration of ..." ? because that's what I got with gcc-2.8.1, and now with gcc-2.95.1 it's getting an error message > Could you please try compiling the following code and add the -v > switch (ie- gcc test.c -o test.exe -v ) and post the output of gcc > please so we can see what exactly is happening. You can use > something like( gcc test.c -o test.exe -v >output.txt ) and post > what was in output.txt. > > #include > int main() { > char *buffer = (char*)xmalloc(1000); > xfree(buffer); > return 0; > } > > See you! > Kalum -------------------- gcc output ------------------------------------------ Reading specs from c:/djgpp/lib/specs gcc version 2.95.1 19990816 (release) c:/djgpp/lib/gcc-lib/djgpp/2.951/cpp.exe -lang-c++ -v -isystem c:/djgpp/bin/include -D__GNUC__=2 -D__GNUG__=2 -D__GNUC_MINOR__=95 -D__cplusplus -Dunix -Di386 -DGO32 -DMSDOS -DDJGPP=2 -DDJGPP_MINOR=2 -D__unix__ -D__i386__ -D__GO32__ -D__MSDOS__ -D__DJGPP__=2 -D__DJGPP_MINOR__=2 -D__unix -D__i386 -D__GO32 -D__MSDOS -D__DJGPP=2 -D__DJGPP_MINOR=2 -D__EXCEPTIONS test2.cpp C:\WINDOWS\TEMP\ccrggSGg.ii GNU CPP version 2.95.1 19990816 (release) (80386, BSD syntax) #include "..." search starts here: #include <...> search starts here: c:/djgpp/lang/cxx c:/djgpp/include c:/djgpp/lang/cxx c:/djgpp/lib/gcc-lib/djgpp/2.951/include c:/djgpp/include End of search list. The following default directories have been omitted from the search path: $DJDIR/lib/gcc-lib/djgpp/2.951/../../../../djgpp/include End of omitted list. c:/djgpp/lib/gcc-lib/djgpp/2.951/cc1plus.exe C:\WINDOWS\TEMP\ccrggSGg.ii -m486 -malign-jumps=2 -malign-loops=2 -malign-functions=2 -m486 -malign-jumps=2 -malign-loops=2 -malign-functions=2 -quiet -dumpbase test2.cc -version -o C:\WINDOWS\TEMP\ccvoUZQi.s GNU C++ version 2.95.1 19990816 (release) (djgpp) compiled by GNU C version 2.95.1 19990816 (release). test2.cpp: In function `int main()': test2.cpp:4: implicit declaration of function `int xmalloc(...)' test2.cpp:5: implicit declaration of function `int xfree(...)' ---------------------------------------------------------------------------