Ah, it is you!
Thanks for the response,
Firstly, it seems to be a bug in the c++ compiler itself ( :( )
Something along these lines :
https://connect.microsoft.com/VisualStudio/feedback/details/362170/function-template-cannot-be-overloaded-by-template-parameter-type
The code is *extremely* primitive, and i am no real stranger to templates.
The confusing thing is the code examples you provided also failed to compile
(after a few hours of blaming my code).
I had a simple class/struct with a single function that i would have like to
expose :
http://pastebin.com/PEwTpWFM
The errors are mentioned in the comments as you can see. If i comment that
line out , it compiles and links just fine. It is a compiler time issues
with the function prototypes,
This also happens in the MyNative ClassBinder demo (deprecated, i know - but
i needed something :) ). Right at the bottom, i have included the line + the
error outputs in full.
It would appear somewhere in the road to templating the compiler adds const
and i have no idea why. I don't want to hack some casts in not understanding
fully.
By far the most informative read on the errors :
http://www.codersource.net/c/c-tutorial-on-templates/c-function-templates-overloading.aspx
:::::::::::: Dump from compiler :::::::::::::
typedef MyNative MY;
w
.BindMemFunc< int, &MY::func1>( "func1" ) <- the exact same error
happens on this line,
Below is the output (spam) from the compiler exact :
Compiling...
MyNative.cpp
g:\dev\v8juice\src\client\sample\boundnative\mynative.cpp(57) : error C2440:
'specialization' : cannot convert from 'int (__thiscall MyNative::* )(void)'
to 'int (__thiscall MyNative::* const )(void) const'
Types pointed to are unrelated; conversion requires reinterpret_cast,
C-style cast or function-style cast
g:\dev\v8juice\src\client\sample\boundnative\mynative.cpp(57) : error C2973:
'v8::juice::ClassBinder<WrappedT>::BindMemFunc' : invalid template argument
'int (__thiscall MyNative::* )(void)'
with
[
WrappedT=MyNative
]
g:\dev2\libv8-juice-20101126\libv8-juice-20101126\src\include\v8\juice\classbinder.h(443)
: see declaration of 'v8::juice::ClassBinder<WrappedT>::BindMemFunc'
with
[
WrappedT=MyNative
]
g:\dev\v8juice\src\client\sample\boundnative\mynative.cpp(57) : error C2668:
'v8::juice::ClassBinder<WrappedT>::BindMemFunc' : ambiguous call to
overloaded function
with
[
WrappedT=MyNative
]
g:\dev2\libv8-juice-20101126\libv8-juice-20101126\src\include\v8\juice\classbinder.h(443):
could be 'v8::juice::ClassBinder<WrappedT>
&v8::juice::ClassBinder<WrappedT>::BindMemFunc<int,int
MyNative::func1(void)>(const char *)'
with
[
WrappedT=MyNative
]
g:\dev2\libv8-juice-20101126\libv8-juice-20101126\src\include\v8\juice\classbinder.h(431):
or 'v8::juice::ClassBinder<WrappedT>
&v8::juice::ClassBinder<WrappedT>::BindMemFunc<int,int
MyNative::func1(void)>(const char *)'
with
[
WrappedT=MyNative
]
while trying to match the argument list '(const char [6])'
On Thu, Dec 9, 2010 at 1:18 AM, Stephan Beal <[email protected]> wrote:
> On Wed, Dec 8, 2010 at 11:14 PM, fuzzy spoon <[email protected]> wrote:
>
>> Anyone every try compiling this on msvc?
>> There are only some minor template/compiler complains that i can't seem to
>> wrap my head around.
>>
>
> If you'll send me the output off-list, i'll take a look. i don't use
> Windows, so i can't do much in terms of trying it out, but maybe i can help
> you through the compiler errors. i remember that on msvc that the "keep
> unreferenced data" option MUST be turned on if you want the plugin layer to
> work, because the plugin layer depends on anonymous objects being
> instantiated when the DLL is opened, and that doesn't happen if that option
> is off. The build option is called /OPT:NOREF. Also turn off precompiled
> headers - they've caused me grief in the past. The last time (according to
> my notes on the topic) is to make sure that language extensions are turned
> ON. i have no idea why, but i found a document where i wrote that that must
> be so, so i'll trust my docs on it.
>
> --
> ----- stephan beal
> http://wanderinghorse.net/home/stephan/
> --
> v8-users mailing list
> [email protected]
> http://groups.google.com/group/v8-users
--
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users