Hi I have a double *ptr which I use as an array.
I am trying to send the address of the ptr to another sub processor.
But I can only send 32 bits to the other processor.So its giving me an error
makes pointer of type integer without a cast.

When I cast it it gives me a bus error.

I am using CELL BE simulator.Any suggestions????

Recommended Answers

All 9 Replies

>>I am trying to send the address of the ptr to another sub processor.

Huh? Are you using a PC or something else? You also need to post some code if you expect anyone to help you very much.


Here's my guess In C language just use the address operator

void foo(int ***variable)
{

}

int main()
{
   int** array = 0;
   foo(&array);
}

I am using VMWare for the Cell BE simulator

it has a method called spe_in_mbox_ write which can be used to send integer type data(address,message etc)

double *ptr;
spe_in_mbox_ write(thread_args.spe_context,(uint32_t*)&ptr,SPE_MBOX...)
its that second parameter thats bugging me giving me a bus error.


Thanks


>>I am trying to send the address of the ptr to another sub processor.

Huh? Are you using a PC or something else? You also need to post some code if you expect anyone to help you very much.


Here's my guess In C language just use the address operator

void foo(int ***variable)
{

}

int main()
{
   int** array = 0;
   foo(&array);
}

What is the size of the double pointer ?

its dynamic

What is the size of the double pointer ?

The size of the double pointer .... Not the size of the array

>>double *ptr;
>>spe_in_mbox_ write(thread_args.spe_context,(uint32_t*)&ptr,SPE_MBOX...)

What you are sending is a pointer to an uninitialized pointer. If the function attempts to write to it that may result in bus error because there was no memory allocated to it.
Maybe what it wants is this: Not that it is NOT a pointer to pointer.

double ptr = 0; // <<<<< change this line
spe_in_mbox_ write(thread_args[i].spe_context,(uint32_t*)&ptr,SPE_MBOX...)

I actually have it intialized.
I think the problem is since its a double (64 bits) and can only send 32 bits..its giving an error

>>double *ptr;
>>spe_in_mbox_ write(thread_args.spe_context,(uint32_t*)&ptr,SPE_MBOX...)

What you are sending is a pointer to an uninitialized pointer. If the function attempts to write to it that may result in bus error because there was no memory allocated to it.
Maybe what it wants is this: Not that it is NOT a pointer to pointer.

double ptr = 0; // <<<<< change this line
spe_in_mbox_ write(thread_args[i].spe_context,(uint32_t*)&ptr,SPE_MBOX...)

>>I think the problem is since its a double (64 bits) and can only send 32 bits.

A pointer is not 64-bits unless you are compiling with a 64-bit compiler. All pointers, regardless of type, are 32-bits when compiling with a 32-bit compiler. So your concern that a double pointer is 64 bits is unfounded -- that is not the problem.

double *ptr;
spe_in_mbox_ write(thread_args[i].spe_context,(uint32_t*)&ptr,SPE_MBOX...)

its that second parameter thats bugging me giving me a bus error.


Thanks

It would be immensely helpful to see an actual code and an actual error message. For now I see a missing count argument.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.