Solved

Making reference to a data segment that is in another file

Posted on 1998-11-08
3
161 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
ID: 1177279
Edited text of question
0
 
LVL 1

Accepted Solution

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

Expert Comment

by:nietod
ID: 1177281
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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
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.

840 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