64 bit shared memory segment C \ linux problems -


I want to make some IPCs with shared memory segments in C ++

I go to make it normally:

  type -file {int a [2]; } Shm_segment;  

...

shm_segment * shm; Int shm_id; Int shm_flags = IPC_CREAT | 0666 int shm_size = sizeof (struct shm_segment) key_t key = 88899; Shm_id = shmget (key, shm_size, shm_flags); // Ies if this error is for choking, but for example I left shm = (shm_segment *) shmat (shm_id, (zero *) 0, 0);

is the last line, where it breaks, when compiling it, it only gives one:

  insert the pointer from a different size integer .  

Everything that I did before this code works perfectly on 32 bit machines (no warning) (exact same code is not tested, but same) , But on my 64 bit this collection is given on this compilation.

And segfaults on running it. Whatever research I have done, I believe that casting from zero * to my pointers causes the indicator to spoil the 64 bit.

Any ideas how can I fix this? Or what is happening because of this

It looks like you shmat () , Therefore the compiler assumes that it returns int .

Be sure that you have

  #include & lt; Sys / shm.h & gt;  

You are included in


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

jquery - SimpleModal Confirm fails to submit form -