Mixing C/C++ and Func. Names



 DEVELOP > c-Plus-Plus > Mixing C/C++ and Func. Names

LINK TO THIS PAGE  


rating :  0   |  0


  Page 1 of 1

1

 
Topic: DEVELOP > c-Plus-Plus
User: "Jeremy Bishop"
Date: 12 Nov 2003 05:24:41 AM
Object: Mixing C/C++ and Func. Names
Hi,
I have a strange error... I am using a C lib with my C++ code. One of the C
lib functions requires a non-member callback function pointer defined by the
following typedef:
typedef void (*Callback)(void *userData, const char *name, const char
**atts);
I defined a function with this prototype, and marked its declaration with
extern "C". The problem is, when my callback function name begins with a
capitol letter, the compiler complains that the function pointer that I pass
cannot be converted to the expected typedef.... but, and here's the kicker,
when the function name begins with a lower-case letter, it works. Am I
going insane here? Any input on this would be helpful,
Thanks
Jeremy
.

User: "Catalin Pitis"

Title: Re: Mixing C/C++ and Func. Names 12 Nov 2003 06:00:43 AM
It is ok like this.
As I understood from your message, if you are saying something like:
SomeFunction( param1, Callback)
it should give you an error (assuming that SomeFunction is the function that
accepts a callback function pointer), because you specified a type as a
parameter, and not a pointer to a function.
If you say something like:
SomeFunction( param1, callback)
it should be ok, assuming that callback is an existing function with the
same signature as Callback typedef specifies.
I didn't see your code, but these are possibilities that I see.
Catalin
"Jeremy Bishop" <jeremy@edg.eu.com> wrote in message
news:bot59i$kst$07$1@news.t-online.com...

Hi,

I have a strange error... I am using a C lib with my C++ code. One of the

C

lib functions requires a non-member callback function pointer defined by

the

following typedef:

typedef void (*Callback)(void *userData, const char *name, const char
**atts);

I defined a function with this prototype, and marked its declaration with
extern "C". The problem is, when my callback function name begins with a
capitol letter, the compiler complains that the function pointer that I

pass

cannot be converted to the expected typedef.... but, and here's the

kicker,

when the function name begins with a lower-case letter, it works. Am I
going insane here? Any input on this would be helpful,



Thanks

Jeremy





.


  Page 1 of 1

1

 


Related Articles
 

NEWER

pg.1232     pg.940     pg.716     pg.544     pg.412     pg.311     pg.234     pg.175     pg.130     pg.96     pg.70     pg.50     pg.35     pg.24     pg.16     pg.10     pg.6     pg.3     pg.1

OLDER