473,395 Members | 1,613 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

pragma value for shared variables

All,

I came to know that, we can define #pragma variables to share values
between the processes.

#pragma data_seg(".shared")
var1
variable2
#pragma data_seg()

Is there are any advantages/disadv. over using file mapping. Can any
one send me detials or any link which compares or explains about these
shared variables

Thanks
Radha G

Sep 13 '07 #1
3 3776
On 2007-09-13 12:30, Oops-c++ wrote:
All,

I came to know that, we can define #pragma variables to share values
between the processes.

#pragma data_seg(".shared")
var1
variable2
#pragma data_seg()

Is there are any advantages/disadv. over using file mapping. Can any
one send me detials or any link which compares or explains about these
shared variables
A problem with all progma directives is that most or perhaps all of them
are implementation dependent. That means that compiling the same code
with another compiler or even just with another version of the same
compiler might give different results. IIRC a compiler should just
ignore any pragmas that it does not understand.

There are an number of different ways to share data between processes,
which one you should use depends on a lot of things, like which platform
your program runs on, how much data you need to share, and in which
manner you need to share it. For better advice explain your needs in a
group discussing your platform. The FAQ have some suggestions of groups:
http://www.parashift.com/c++-faq-lit...t.html#faq-5.9

--
Erik Wikström
Sep 13 '07 #2
On Sep 13, 4:30 pm, Erik Wikström <Erik-wikst...@telia.comwrote:
On 2007-09-13 12:30, Oops-c++ wrote:
All,
I came to know that, we can define #pragma variables to share values
between the processes.
#pragma data_seg(".shared")
var1
variable2
#pragma data_seg()
Is there are any advantages/disadv. over using file mapping. Can any
one send me detials or any link which compares or explains about these
shared variables

A problem with all progma directives is that most or perhaps all of them
are implementation dependent. That means that compiling the same code
with another compiler or even just with another version of the same
compiler might give different results. IIRC a compiler should just
ignore any pragmas that it does not understand.

There are an number of different ways to share data between processes,
which one you should use depends on a lot of things, like which platform
your program runs on, how much data you need to share, and in which
manner you need to share it. For better advice explain your needs in a
group discussing your platform. The FAQ have some suggestions of groups:http://www.parashift.com/c++-faq-lit...t.html#faq-5.9

--
Erik Wikström
ThanQ Erik. I am working on Windows and *NIX
environments(Linux,AIX,solaris,HP-UX). I am using shared memory(POSIX-
on linux,File mapping object on windows) for IPC. The data size that
shared between the the process is 1-2 kB. Is there any other better
way to have IPC between processes? Do you know the exclusive IPC
group? Please send me the details.

Thanks
Radha. G.

Sep 14 '07 #3
Oops-c++ wrote:
>
ThanQ Erik. I am working on Windows and *NIX
environments(Linux,AIX,solaris,HP-UX). I am using shared memory(POSIX-
on linux,File mapping object on windows) for IPC. The data size that
shared between the the process is 1-2 kB. Is there any other better
way to have IPC between processes? Do you know the exclusive IPC
group? Please send me the details.
Forget pragmas and use the standard shared memory APIs on you platforms.

--
Ian Collins.
Sep 14 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: ryang | last post by:
I am trying to understand how to work with Unicode in Perl. I have read the relevant man pages (perluniintro, perlunicode, etc.) and have written severl scripts to test/verifiy my understanding. ...
20
by: Glenn Venzke | last post by:
I'm writing a class with a method that will accept 1 of 3 items listed in an enum. Is it possible to pass the item name without the enum name in your calling statement? EXAMPLE: public enum...
8
by: gemel | last post by:
I have been reading sime material in .NET that throws some doubt on my understanding of shared procedures. With regard to object programming I assumed that variables declared within a class were...
7
by: Marco | last post by:
The subject pretty much says it all. I need to create a form like the msgbox that returns a value, how would I go about doing this?
5
by: Confused ! | last post by:
I am writing an ASP.NET application and I want to use shared members on the data layer to retreive information from the SQL Server. If I declare a Function to be Shared, how will this affect...
15
by: muttaa | last post by:
Hello all, I'm a beginner in C...May i like to know the difference between a #pragma and a #define.... Also,yet i'm unclear what a pragma is all about as i can find topics on it only in...
2
Semprini
by: Semprini | last post by:
Hiya, I'm programming a dll in VC6 which is uses windows hooks (WH_GETMESSAGE). So I have a HOOKPROC which is called whenever messages are sent the the monitored hwnd I have a shared data...
0
by: netkadirisani | last post by:
Hi, i built a dll (used vb.net) that has some shared variables. the basic idea of using the shared variables is to read some values from the database and save them in the shared variables during the...
0
debasisdas
by: debasisdas | last post by:
PRAGMA:-Signifies that the statement is a pragma (compiler directive). Pragmas are processed at compile time, not at run time. They pass information to the compiler. A pragma is an instruction to...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.