Actually, I've reviewed this a little more closely, and found
one difference that may be significant, even though it 
shouldn't be.  My code is actually:

void MyCall(const char ** x);

void my_fun()
{
        char myPointer[50];

        ...

        MyCall(&myPointer);
        ...

        return;
}

I'm passing a pointer to a char *.  Does anyone
know why the compiler fails this?


> This thread was opened a long time ago, but I hit an issue
> related to it today--this thread is the closest I could find
> in the archives:
> 
> >> ... I have an API call which requires a const char *x, 
> >> how do I pass the variable myString in the function call ...
> >
> > hehe.. this dont work?
> >
> >    APICall( (const char *) myPointer );
> >
> >  ???
> 
> Why is the "const" in "(const char *)" needed?
> 
> basically, what I want to do is:
> 
> void APICall(const char * x);
> 
> void my_fun()
> {
>       char myPointer[50];
> 
>         ...
> 
>       APICall(myPointer);
> 
>         ...
> 
>       return;
> }
> 
> 
> I understand that the reverse would be true--I shouldn't pass a
> const char * to a routine that would modify it, but in this case
> I'm passing a char * to a routine that is basically promising not
> to modify it--but APIcall() doesn't really care if the variable passed
> in is const or not.
> 
> I've got code like this all over in CW R6 that worked fine (and also
> on other compilers, too), but now I get compiler errors in CW R7.
> Is there a way to turn off that error?
> 
> 
> thanks
> 
> Jeff Pahren
> Franklin Electronic Publishers, Inc.
> 
> 
> 
> 
> -- 
> For information on using the Palm Developer Forums, or to unsubscribe, please see 
>http://www.palmos.com/dev/tech/support/forums/
> 

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to