extern Class
Monkey Forums/Monkey Programming/extern Class
| ||
Hi, i'm working on a c++ Socket Library, so i use the extern Class sockaddr_in Extends sockaddr Field sin_family:Int Field sin_port:Int Field sin_addr:in_addr Field sin_zero1:Int Field sin_zero2:int End And now, i want to use debug mode, but transcc gives me the following error: main.cpp: In instantiation of 'String dbg_value(T*) [with T = sockaddr_in*]': main.cpp:1383:27: required from 'String dbg_var_type_t<T>::value(void*) [with T = sockaddr_in*]' main.cpp:3771:1: required from here main.cpp:1351:38: error: cannot dynamic_cast '* t' (of type 'struct sockaddr_in*') to type 'class Object*' (source type is not polymorphic) main.cpp: In instantiation of 'String dbg_value(T*) [with T = WSAData*]': main.cpp:1383:27: required from 'String dbg_var_type_t<T>::value(void*) [with T = WSAData*]' main.cpp:3771:1: required from here main.cpp:1351:38: error: cannot dynamic_cast '* t' (of type 'struct WSAData*') to type 'class Object*' (source type is not polymorphic) the final code of the project: sockaddr_in* t_Address=(new sockaddr_in); DBG_LOCAL(t_Address,"Address") Any chance to set a extern class to "nodebug" infos? |
| ||
I believe what you try to do is not possible because your object class cannot extend your struct . Depending on your context it might be a good idea to only expose the Methods (Virtual?) of your class to Monkey. |
| ||
The problem is, i work with socket structs. Monkey want create a debug value of the extern struct, but this is not of the type gc_object. It would bi great, when i can declare a extern class to nodebug... I think, i must rewrite transcc... |
| ||
You could take a look @ MonkeyX\modules\brl\native\socket.cpp and MonkeyX\modules\brl\socket.monkey to see how the original socket implementation looks like. The problem is, i work with socket structs. I do not see a possibility to get the struct thing to work out of the box. Best way is probably to convert your struct into a class or to put it in a class.(Or try the Adapter) Alternatively you could hide the struct completely from Monkey X and only Expose Functions or Methods which perform actions without Monkeys knowing. It would bi great, when i can declare a extern class to nodebug... I don't know exactly what you are doing but it looks like to me you are trying to create a class which is no Monkey X Object. In this case try to extend null: Class MyClass Extends Null="MyC++ClassName" End |
| ||
@off topic Sehe gerade, du kommst aus Deutschland. Hast du Skype? |
| ||
pharmhaus_2.0 |