Link to home
Start Free TrialLog in
Avatar of whluk
whluk

asked on

Making reference to a data segment that is in another file

Sorry guys... I can't find another group that matches my needs
but anyway...

How do I make reference to a data segment that is in another file?
for examples:

In file A,

_DATASEG segment para public use16
        data_123  db 0
_DATASEG ends


In file B,

mov ax, _DATASEG
mov ds, ax

Can I do this?
extrn _DATASEG:far in both files or there is another method?!

Best Regards,
Jacky Luk
Avatar of whluk
whluk

ASKER

Edited text of question
ASKER CERTIFIED SOLUTION
Avatar of arun_ta
arun_ta

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
If that doesn't work.  (I'm not sure what assembler you are using)  You can declare the segment in the second file and place no data in it.    Like

_DATASEG segment para public use16
_DATASEG ends

Then the 2nd file will know about it as well.  This is allowed (in MASM at least) you can declare segments multiple times with or without data, the linker will find all the segments definitions and collect them together into one segment