From: (Ravi) Newsgroups: comp.os.msdos.djgpp Subject: Declaring external assembly procedures Date: Wed, 04 Feb 1998 23:55:32 GMT Organization: Home Lines: 43 Message-ID: <6bav9a$mlo@camel18.mindspring.com> NNTP-Posting-Host: user-38ld9cs.dialup.mindspring.com To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk I'm trying to link in some external assembler stuff with DJGPP, and am getting some results I didn't expect. The asm file is compiled with NASM into COFF format: ---external.asm--- global _Test bits 32 SECTION .text Use32 ; int Test(void) _Test mov eax, 5 ret The C++ test file is -----test.cpp------ #include // extern int Test (void); int x; main() { x = 1; x = Test(); printf ("%i", x); } This works, but of course gives the implicit declaration warning. When I uncomment the extern statement, however, I get a SIGSEGV error, which can be fixed by removing the parenthesis from the call to Test. I then get a warning that I need to type cast the procedure, and inevitably get 0 in x. I keep thinking there's a dumb mistake I've overlooked, but can't find it. I've also installed RSXNTDJ, if that does anything funky to the compiler. Thanks for any help, Ravi.