Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Re: [Linux] Shared memory and pointers

Reply
Thread Tools

Re: [Linux] Shared memory and pointers

 
 
Victor Bazarov
Guest
Posts: n/a
 
      05-14-2012
On 5/14/2012 11:17 AM, Willy wrote:
> I've a problem with shared memory and pointers.


Shared memory is not defined by the language, nor is interprocess
communication (how, for instance, memory addresses are mapped between
two different processes, whether the memory is shared or not). You'll
be better off asking about platform-specific elements in that platform's
newsgroup. Try 'comp.os.linux.development.*' hierarchy.

Good luck!

> I've a struct like this in shm:
>
> typedef struct my_struct
> {
> char mat[3][10];
> char * p_mat;
> }my_struct;
>
> and a process A that sets:
>
> shm->p_mat = &shm->mat[2];
>
> Another process B that try to print it:
>
> printf("%s",shm->p_mat);
>
> I obtain a segmentation fault.
>
> I think that is not the right way to use pointers in shared memory, but
> I can't find more info.


V
--
I do not respond to top-posted replies, please don't ask
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: [Linux] Shared memory and pointers Nobody C++ 0 05-16-2012 05:56 AM
Re: [Linux] Shared memory and pointers Juha Nieminen C++ 0 05-15-2012 09:38 AM
Re: [Linux] Shared memory and pointers BGB C++ 0 05-14-2012 04:16 PM
pointers, pointers, pointers... cerr C Programming 12 04-07-2011 11:17 PM
Shared Public Variables and Shared Methods Joe Fallon ASP .Net 3 07-16-2004 07:11 AM



Advertisments