Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 167
  • Last Modified:

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
0
whluk
Asked:
whluk
1 Solution
 
whlukAuthor Commented:
Edited text of question
0
 
arun_taCommented:
declare _DATASEG as public in file A.
In file B use extrn.
0
 
nietodCommented:
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
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now