View topic - share memory and memory map problem

share memory and memory map problem

Discussion about the general applications that run on QNX6

share memory and memory map problem

Postby sluu » Thu Jul 18, 2002 10:59 pm

I got a problem upgrading shared memory from QNX4.0 to Neutrino and this is the problem:

int mem;
unsigned char *where

where=mmap(o, 4096, PROT_READ|PROT_WRITE, MAP_SHARED, mem, 0)

mem=shm_open("mem_test", O_CREAT|O_RDWR, 0777)

strcpy(where, "original string");

The complier complains about the strcpy. Why is that? thanks.
New Member
Posts: 1
Joined: Thu Jul 18, 2002 10:52 pm

wrong order

Postby Frank » Fri Jul 19, 2002 11:14 am

Try to change the order of your function calls. First shm_open, then use ftruncate(when you are creating the shared mem). After that use the mmap function.
Good luck
Frank 8)
New Member
Posts: 7
Joined: Tue Jul 09, 2002 5:44 am

Postby mritun » Thu Aug 15, 2002 12:57 pm


Apart from mistake in your code (which Frank pointed out), you can fix the compiler error by-

1. Quick-method
a) Use qcc !
b) Use "-fno-builtin -fhonor-std" options with gcc/g++
c) Prefix "std::" with all functions you get error like "std::strcpy"

2. Read the "namespaces" chapter from Stroupstrop (sorry spelling mistake probably) or Bruce Eckle's Thinking in C++ (available online or free from

_ Akhilesh Mritunjai
QNX Master
Posts: 16
Joined: Mon Aug 12, 2002 12:40 pm
Location: Mumbai, India

And this is the wrong group.

Postby phearbear » Fri Aug 16, 2002 4:53 pm

Next time, try the programming groups for programming questions.
QNX Master
Posts: 110
Joined: Fri Jul 05, 2002 11:44 pm

Return to QNX6 - Applications

Who is online

Users browsing this forum: No registered users and 1 guest