delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/07/26/09:50:24

Message-ID: <19990726135211.18814.rocketmail@send205.yahoomail.com>
Date: Mon, 26 Jul 1999 09:52:11 -0400 (EDT)
From: Mohamed Saad <bazramit AT yahoo DOT com>
Subject: Assembly routines with C++
To: djgpp AT delorie DOT com
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com

Hi All,
   How are u? hope all is ok! ;)

   well... i am currently switching from C to C++! I
have a C program that i want to transform into
object-oriented approach! but i have one simple (I
hope! :)) question!
 
   I had an .asm file compiled and linked with my
program! This file contained a function called
line()... here is its prototype...

void line(int x1,int y1,int x2,int y2,char color,void*
back);

well... back is the back buffer.... and it is global!

line() was called from several other parts in my
program... (e.g. in gui.c and in main.c!)

well... now, to make it into object oriented, the
function line should be a member of the Class called
'screen'! the back buffer also should be a member of
the 'screen' Class...

So... where is the problem?
well... other objects (e.g. gui) should NOT have
access to the backbuffer data structure! OOP
principles are clear! Classes should never export data
structures! it should export a method to modify this
data structure...
so... back will be hidden from other classes!! they
will not be able to call line()!

so... is there a way so that i can make the .asm file
*see* the member back of the Class called 'screen'? so
that it can modify it?  line() is a member of the
class... but, how can i persuade the *assembler* (NASM
btw!!)...

Any suggestions are welcome! Thanx in advance!

URS forever, 
   Mohamed El Dawy

_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

- Raw text -


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