Re: C to C++ by Scot
Scot
Tue Feb 07 21:59:12 CST 2006
You're right that it is legal to have the same name, since the signatures aren't the same. However,
if you simply pass "frame_received" as the parameter, the compiler must decide which of the two
functions with this name you mean. If it chooses the member function, you get the same error. Try
passing "::frame_received", or rename the wrapper, to make sure it knows you mean the one at global
scope.
"Jacky Luk" <jl@knight.com> wrote in message news:OdQ5yJGLGHA.2696@TK2MSFTNGP14.phx.gbl...
>
> "Scot T Brennecke" <ScotB@MVPs.spamhater.org>
> ¼¶¼g©ó¶l¥ó·s»D:eDCgEGGLGHA.744@TK2MSFTNGP09.phx.gbl...
>> Jack,
>> It looks like you're on the right track this time, but since I can't see the relevant code or
>> the exact error message, I can't be sure you did it right. Did the error message change at all?
>> You named your wrapper function with the same name as the member -- is the compiler confused
>> about which one you mean?
>>
> Same Error. Would one object in one object space with another in C space (whatever you call it)
> cause errors?
> I think due to data mangling, their names can be the same... So the error persists... the error
> message is pointing to vortex_profiles_register (PLAIN_PROFILE,
> start_channel, NULL,
> close_channel, NULL,
> frame_received, NULL);
>
> vortex.aspl.es
> Thanks
> Jack
>
>> "Jacky Luk" <jl@knight.com> wrote in message news:uBQnK4FLGHA.140@TK2MSFTNGP12.phx.gbl...
>>>
>>> "Scot T Brennecke" <ScotB@MVPs.spamhater.org>
>>> ¼¶¼g©ó¶l¥ó·s»D:%23CgGeoFLGHA.604@TK2MSFTNGP14.phx.gbl...
>>>> Jack,
>>>> Telling me that does not change my answer. You still can't use a member function if the
>>>> expected function signature does not have the implied 'this' pointer. Using "this->" doesn't
>>>> change anything -- it's just excessive.
>>>
>>> Dear Scot,
>>> Could you propose a solution? I tried today using a thunk
>>> extern "C" {
>>> #include <vortex.h>
>>> };
>>> extern Wireless *wl;
>>> void frame_received(...)
>>> {
>>> wl->frame_received(...);
>>> }
>>> still no good
>>>
>>>>
>>>> "Jacky Luk" <jl@knight.com> wrote in message news:O3CNtbFLGHA.464@TK2MSFTNGP15.phx.gbl...
>>>>>
>>>>> "Scot T Brennecke" <ScotB@MVPs.spamhater.org>
>>>>> ¼¶¼g©ó¶l¥ó·s»D:%23qVe6XFLGHA.360@TK2MSFTNGP12.phx.gbl...
>>>>>> OK What I gather is that you are needing a non-class-instance-member function, and you're
>>>>>> trying to use an instance-member function to solve it. C++ class instance members have an
>>>>>> implied (present, but hidden) first parameter which is a 'this' pointer, making the function
>>>>>> not match the required signature.
>>>>>
>>>>> Hi Scot
>>>>> Thanks for your reply. Actually (should have told you) that this->frame_received inside the
>>>>> vortex_profile_register still resulted in the same error...
>>>>> Thanks a lot really
>>>>> Jack
>>>>>
>>>>>>
>>>>>> "Jacky Luk" <jl@knight.com> wrote in message news:%23jL2qPFLGHA.2604@TK2MSFTNGP09.phx.gbl...
>>>>>>>I have tried different support media on the net. But did not get any responses. So I resort
>>>>>>>to this server...
>>>>>>> Have to apologize first because it is a Linux question but it is a C++ problem as well
>>>>>>> IDE: KDevelop
>>>>>>> Compiler: g++
>>>>>>>
>>>>>>> error: vortex-server.cpp: 95 error: argument of type 'gboolean (Wireless::)(gint,
>>>>>>> VortexConnection*, void *)' does not match 'gboolean (*)(gint, VortexConnection*, void *)
>>>>>>>
>>>>>>> Code snippnet
>>>>>>>
>>>>>>> Wireless::Vortexmain(...)
>>>>>>> vortex_profiles_register ( PLAIN_PROFILE,
>>>>>>> start_channel, NULL,
>>>>>>> close_channel, NULL,
>>>>>>> frame_received, NULL);
>>>>>>>
>>>>>>> and
>>>>>>> Wireless::frame_received(...)
>>>>>>> {
>>>>>>> }
>>>>>>>
>>>>>>> Thanks in advance
>>>>>>> Jack
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>