hust-marx / firebreath

Automatically exported from code.google.com/p/firebreath
0 stars 0 forks source link

Compile error trying to send JSAPIPtr in FireEvent. #128

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Compile attached project
2.
3.

What is the expected output? What do you see instead?
Clean compile.

What version of FireBreath are you using? On what operating system and
browsers?
Latest as of Jan. 14/11

What version of your compiler or IDE are you using?
VS2005

Please provide any additional information below.

Compiler appears to have issue with casting the JSAPIPtr to a variant.

Original issue reported on code.google.com by Geoff.Cu...@rogers.com on 14 Jan 2011 at 6:23

Attachments:

GoogleCodeExporter commented 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