Solved

Making reference to a data segment that is in another file

Posted on 1998-11-08
3
158 Views
Last Modified: 2010-04-02
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
Comment
Question by:whluk
3 Comments
 

Author Comment

by:whluk
Comment Utility
Edited text of question
0
 
LVL 1

Accepted Solution

by:
arun_ta earned 100 total points
Comment Utility
declare _DATASEG as public in file A.
In file B use extrn.
0
 
LVL 22

Expert Comment

by:nietod
Comment Utility
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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now