Open GoogleCodeExporter opened 9 years ago
The problem with your code actually has nothing to do with the JSAPIPtr casting
to a variant. Actually, the problem is in your CDAUserAction class; you can't
use a user-defined ENUM type as a parameter to a JSAPIAuto function, because
FB::variant has no idea how to convert any of the types it can get from the
browser to that enum. Instead, accept an int, do some typechecking, and then
cast it to the enum type.
If you follow the trace in the output down to the bottom of the error message
you'll find that the error originates on line 58 of dauseraction.h
When you call registerMethod for AddUserOption it tries to create a wrapper for
that method that converts all the types. Since it can't convert to the type
you need it won't compile.
As a side note, you should *never* put function implementation in a .h file. It
is really bad practice and will cause link errors if you ever include that file
from another cpp file.
You can return enum types, since those can be converted to an int.
Original comment by rich...@firebreath.org
on 14 Jan 2011 at 6:47
Original issue reported on code.google.com by
Geoff.Cu...@rogers.com
on 14 Jan 2011 at 6:23Attachments: