TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: All
from: Marcel Vandevusse
date: 1996-11-29 21:05:48
subject: GCC and ALP

I am porting a program from linux to OS/2, using GCC to compiler the C
code, and ALP (a MASM compatible compiler from IBM for 32 bit OS/2) to
assemble the assembly. Now the problem is with global variables that need
to be seen by both. I tried to link both with ILINK and LINK386, with the
same results. Example: one of the variables is calles PARG (_PARG in the
assembly code).

In the C code:

unsigned long PARG=0;

in the C .h file:

extern long PARG;

and in the assembly file:

EXTRN _PARG:DWORD

The C code can use this variable no problem, and when looking at the code
through IPDM, it is referenced as address 0x0002 0040. As soon as the
assembly language part tries to access the variable (even just trying to
read it) I get an access violation. The problem is that IT is trying to
access the variable as 0x0000 0040.

Is this a quirk with ALP, a problem with GCC, a linker bug, or an error on
my part? This is the first time I'm trying to link an executable from
object files created by more than one program (be it a compiler or an
assembler).



--- Maximus/2 3.01
* Origin: The Data Zone - FINALLY ONLINE! - (330)602-0169! (1:2265/1)
SEEN-BY: 50/99 270/101 620/243 625/160 711/401 409 410 413 430 808 809 934
SEEN-BY: 711/955 712/407 515 624 628 713/317 800/1
@PATH: 2265/1 2215/12 3615/50 396/1 270/101 712/515 711/808 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.