I was cleaning out my box and ran across my "Realization Of The Self..." post, just wanted to say nevermind :} I wrote that post because at the time I figured that since GPC objects are not compatible with DJGPP classes EDI might as well contain Self. I was porting my libs to DJGPP for the heck of it and found out that GPC and DJGPP are OO compatible to a certain point. All you have to do when writing an external assembly program for an object member is to declare a global for each version of the name. The following is an example of what I mean (not tested, writing it off the top of my head, tho it should work. If not let me know and I'll repost it after verifying):
// begin test.cc #include <stdio.h>
class tmyclass { public: int bar;
int foo(); };
main() { tmyclass myclass;
myclass.bar = 35;
printf( "Should be equal %i %i\n", myclass.bar, myclass.foo() ); } // end test.cc
{ begin test.pas } program test;
type tmyclass = object bar : Integer;
function foo: Integer; end;
var myclass : tmyclass;
begin myclass.bar := 35;
WriteLn( 'Should be equal ', myclass.bar, ' ', myclass.foo ); end; { end test.pas }
# begin testo.s .globl _foo__8tmyclass # DJGPP name .globl _Tmyclass_Foo # GPC name
.text _Tmyclass_Foo: _foo__8tmyclass: movl 4(%esp), %edi # Get Self pointer from the stack movl 4(%edi), %eax # Set function result to tmyclass.bar ret # end testo.s
rem begin mktest.bat gpc test.pas testo.s -o testp.exe gcc test.cc testo.s -o testc.exe rem end mktest.bat
Reason number 1,000,001 to use GPC =B)
See ya! Orlando Llanes
"Meine Damen und Herren, Elvis hat soeben das Gebaeude verlassen!"
"Look out fo' flyeeng feet" O__/ a010111t@bc.seflin.org /|____. O <__. /> / \ ____________|_________ http://ourworld.compuserve.com/homepages/Monkey414
Orlando Llanes wrote:
I was cleaning out my box and ran across my "Realization Of The
Self..." post, just wanted to say nevermind :} I wrote that post because at the time I figured that since GPC objects are not compatible with DJGPP classes EDI might as well contain Self.
It may or may not. Better do not rely on `Self' being a specific register because that can heavily depend on the optimization level.
I was porting my libs to DJGPP for the heck of it and found out that GPC and DJGPP are OO compatible to a certain point.
Sorry? DJGPP is a platform several compilers - including GPC and GCC - can run on. You are probably talking about compatibility between GPC and G++.
All you have to do when writing an external assembly program for an object member is to declare a global for each version of the name. [...]
Funny. So the mechanisms to link OOP stuff are almost the same in G++ and GPC ... (:
Greetings,
Peter
On Thu, 14 Jan 1999, Peter Gerwinski wrote:
Sorry? DJGPP is a platform several compilers - including GPC and GCC - can run on. You are probably talking about compatibility between GPC and G++.
I knew that DJGPP is a port of GCC, but I guess I'm just used to saying DJGPP for the GCC/DJGPP port :P (G++ included)
Funny. So the mechanisms to link OOP stuff are almost the same in G++ and GPC ... (:
I have not tried it with multiple inheritance in C++, but I have tried declaring/accessing variables declared in a parent and child object. Parent and child data are grouped together in one place. From what I was reading about multiple inheritance, all it really does is take methods from two objects and put them into one as tho they were all declared into a single class, so GPC can prolly be (with a little coaxing, as in the globals trick) compatible with G++ in that sense. Another thing I haven't tried is calling virtual functions. If GPC allows asmname to be used on object methods, I'm sure GPC would at least be 80% compatible with G++ objects (a class could be declared in G++, then "imported" into GPC like the C functions already do).
See ya! Orlando Llanes
"Meine Damen und Herren, Elvis hat soeben das Gebaeude verlassen!"
"Look out fo' flyeeng feet" O__/ a010111t@bc.seflin.org /|____. O <__. /> / \ ____________|_________ http://ourworld.compuserve.com/homepages/Monkey414