By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,413 Members | 1,023 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,413 IT Pros & Developers. It's quick & easy.

Mixing C/C++ and Func. Names

P: n/a
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

Jul 19 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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" <je****@edg.eu.com> wrote in message
news:bo*************@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


Jul 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.