delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/04/13/20:55:53

From: "Andrew Davidson" <andrew AT lemure DOT freeserve DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Calling C functions from machine code...
Date: Wed, 14 Apr 1999 01:21:03 +0100
Organization: Customer of Planet Online
Lines: 15
Message-ID: <7f0mvu$qq0$1@news6.svr.pol.co.uk>
NNTP-Posting-Host: modem-89.depacon.dialup.pol.co.uk
X-Trace: news6.svr.pol.co.uk 924049214 27456 62.136.60.217 (14 Apr 1999 00:20:14 GMT)
NNTP-Posting-Date: 14 Apr 1999 00:20:14 GMT
X-Complaints-To: abuse AT theplanet DOT net
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2014.211
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2014.211
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

I'm trying to call a couple of simple functions written in C from within
some dynamically created machine code in one of my programs.
All I know so far is that I can find the return value of the function
(assuming it is 32bits or less) in eax and that I should push all the
parameters of the function as 32bit values (incidentally, is eax clobbered
if the function is void?). However, I don't know what exactly I should be
pushing as simply pushing the parameters causes a sigill error after the
function has completed. Also what is left on the stack after the function
has finished?

Thanks for any help,
Andrew



- Raw text -


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