473,461 Members | 1,515 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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

Jul 19 '05 #1
1 2226
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Kamal | last post by:
Is it possible to implement video mixing technique (video merging technique) in JMF, where sources of the video data are remote hosts across the network transmitting real-time data??? The output...
90
by: Mark Hahn | last post by:
"Michael Geary" <Mike@Geary.com> wrote ... >Does anyone have some sample code where obj$func() would be used? > (Apologies if I missed it.) There have been so many messages about delegation...
4
by: Kevin L | last post by:
Below is a code snippet that fails to compile under vc.net class BaseInterface { public: virtual void f() = 0; }; class BaseImplementation : public BaseInterface {
4
by: Cristian Tota | last post by:
Hi, I'd appreciate any thoughts on mixing C++ and C code. I have a project that uses a given C interface, the rest of the project can be either in C or C++. What would be the recomended design...
3
by: Phil396 | last post by:
I am trying to mix metacharacters and the literal versions in an expression and no matter what I try it does not work. Here is the code customer = Regex.Replace(customer,"$",""); I want to...
28
by: ziman137 | last post by:
Hello all, I have a question and am seeking for some advice. I am currently working to implement an algorithmic library. Because the performance is the most important factor in later...
37
by: jht5945 | last post by:
For example I wrote a function: function Func() { // do something } we can call it like: var obj = new Func(); // call it as a constructor or var result = Func(); // call it as...
28
by: Yevgen Muntyan | last post by:
Hey, Consider the following code: void func (void) { } void func2 (void) {
24
by: dmitrey | last post by:
Hi all, I looked to the PEPs & didn't find a proposition to remove brackets & commas for to make Python func call syntax caml- or tcl- like: instead of result = myfun(param1, myfun2(param5,...
6
by: hsmit.home | last post by:
Hello, I came across a strange error and it's really been bugging me. Maybe someone else has come across this and any insight would be appreciated. What I'm trying to accomplish is using...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.