From: William S F. <ws...@fu...> - 2011-08-27 16:13:17
|
On 16/08/11 16:26, Ralph Gauges wrote: > Hi, > > I am currently trying to create language bindings for R and I think I > might have found a bug in the way enums are handled. > > Since I don't really know R (yet), I might be wrong, but it looks to me > that enums from class are created as .__E___CLASSNAME__ENUMERATIONNAME > where CLASSNAME is the name of the class the enumeration is defined in > and ENUMERATIONNAME is the name of the enumeration. > The generated code is able to translate enumeration integers to string > just fine, but when I try to call a function the takes an enumeration as > an argument, the backwards translation from string to enum fails because > R is looking for .__E___p_CLASSNAME__ENUMERATIONNAME instead of > .__E___CLASSNAME_ENUMERATIONNAME. This is due to (in my opinion) > incorrect class to the enumToInteger function. This function get a > string as the second argument in in all these strings, I can see the > leading "_p" which probably denotes that is is an external pointer. When > I remove this _p from the string, the translation from string to enum works. > > It would be very nice if someone could tell me whether this is a bug in > SWIG 2.0.4 or if I am making some stupid mistake. > I don't know R very well, and tried to recreate this but couldn't, but if you give a full example including the R code, I may be able to help. William |