www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/12/03/21:52:44

From: Tudor <tudor AT cam DOT org>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Can asm proc return a value?
Date: Tue, 03 Dec 1996 17:29:11 -0800
Organization: Communications Accesibles Montreal
Lines: 67
Message-ID: <32A4D3E7.14C7@cam.org>
References: <848818752 AT beginners DOT net>
Reply-To: tudor AT cam DOT org
NNTP-Posting-Host: dynppp-94.hip.cam.org
Mime-Version: 1.0
To: Chris Gouldie <chris DOT gouldie AT beginners DOT net>
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Chris Gouldie wrote:
> 
>   Listen, I apologize if this is sort of a beginner question. I need to
> find out how to return a value from an asm procedure. I'm using o2c (the
> obj to coff converter), so this is for tasm.
> 
>   Also, how do I set up the prototype in my c++ program? Can I return
> structs etcetera, or only pointers to them? Here is a sample:
> 
> p386
> ideal
> model flat,c
> 
> extern malloc: proc
> 
> virt dd ?
> 
> public  makevirt
> proc    makevirt
>         push    64000
>         push    0
>         call    malloc
>         pop     virt
>         ;I want to return virt to the c++ program
>         ret
> endp    makevirt
> end
> 
> /* C++ program */
> 
> void main ()
> { unsigned char * virtscreen = makevirt ();
> }
> 
> So my question is, what do I add to make this compile?
> 
> All help greatly appreciated,
> 
> Chris Gouldie
I don't know in this particular example but usually you return values to
C/C++ in AX
-- 
tudor 'at' cam 'dot' com

http://www.cam.org/~tudor - last 'updated' 4 months ago...



-----BEGIN GEEK CODE BLOCK-----

     Version: 3.1

     GCS d(-)@>-- s-()>+:(+)>- a--- C+(++)>+++>$ ULC(+)@>++++
P+(+)>++++>$

     L(+)>+++++>$ E-(--)?>++ W++(++)>+++>$ N(+)@>+++ o(-)?>+
K---(----)?>-

     w(---)@>-- !O--(----)>++ !M(+)>- V--(-)?>-- PS--(-)?>+++ !PE(+)>-

     Y(+)>++>$ PGP+(++)>++++>$ t---(+++)@>+++ !5(-)>-- X++(+++)>$>++++

     R+()>+++>$ tv(+)@>++ b+(++)?>+++ DI-(--)?>--- !D(+)>+++ G++(+)@

     e-()>++++>$ h(--)?>++ !r(--)?>+++ !y(--)>+++++@

     ------END GEEK CODE BLOCK------

- Raw text -


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