delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/09/22/20:46:08

From: Bart Trzynadlowski <trzy AT powernet DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: SIGSEGV w/ asm?
Date: Wed, 22 Sep 1999 15:50:22 -0700
Organization: I am not organized!
Lines: 33
Message-ID: <37E95D2E.C9237BAF@powernet.net>
NNTP-Posting-Host: p3-2.reno.powernet.net
Mime-Version: 1.0
X-Mailer: Mozilla 4.5 [en] (Win95; I)
X-Accept-Language: en
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hi,
    I am trying to call an external assembly procedure from within a C
program but I keep getting stack faults and GPFs. The assembler used is
NASM, I'm assembling to COFF format and linking correctly. Here is the
code:

main.c:

extern void asm_test(void);

int main()
{
    asm_test();
    return 0;
}

asm.asm:

bits 32
section .text

global _asm_test
_asm_test:
    ret

NASM uses global in place of public and since I declared "bits 32" it
will use the correct form of the ret instruction (retd on most
assemblers).

Thanks,

Bart Trzynadlowski

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019