Re: WG: AW: [Acdk-developer] Compiling problem
Brought to you by:
kommer
From: Miroslav N. <mi...@sp...> - 2005-06-13 10:46:39
|
Dear Roger, Thank you very much for the help. I have the following principle question: in case that we would like to load some class dynamically through class name and in case that this class is not included in our EXEcutable file because of compilator optimization how can we load this class? Best Regards, Miroslav Nachev RRK> Hi, RRK> The problem with the code you send: RRK> class ACDK_CORE_PUBLIC NewObjects : extends acdk::lang::Object RRK> The macro ACDK_CORE_PUBLIC is reserved to acdk_core library to export the RRK> symbols of acdk_core. RRK> When you declare objects in executable, you don't need any export/import RRK> macros: RRK> class NewObjects : extends acdk::lang::Object >> This code can't be runned: >> RStringBuffer sb1 = new StringBuffer("M"); >> RStringBuffer sb2 = sb1->clone(); RRK> This code should even not be compiled. RRK> The clone() method returns a Robject and you should receive an error like RRK> that: RRK> error C2440: 'initializing' : 'class RefHolder<class acdk::lang::Object>' RRK> cannot be converted into 'class RefHolder<class acdk::lang::StringBuffer>'. RRK> You have to cast the Robject result: RRK> RStringBuffer sb2 = (RStringBuffer)sb1->clone(); RRK> See also: RRK> http://acdk.sourceforge.net/acdk/docs/hb/lang/acdk_hb_lang_casting.html >> System::out->println(this->getClass()->getName()); >> The result of this is "acdk::lang::Object". RRK> ACDK uses metainfo / extented runtime type information generated by the RRK> acdkmc compiler: RRK> The first step is to modify the header: RRK> ACDK_DECL_CLASS(NewObjects); RRK> class NewObjects : extends acdk::lang::Object { RRK> ACDK_WITH_METAINFO(NewObjects) // THIS is for the metainfo RRK> private: RRK> int myValue; RRK> public: RRK> NewObjects(int intParam); RRK> virtual ~NewObjects(); RRK> static int acdkmain(RStringArray args); RRK> void showValues(); RRK> }; RRK> acdkmc works for complete modules/directories. It also expects an header RRK> file with the exact name of the directory. In this case acdktest1.h. RRK> Then execute the metacompiler acdkmc: RRK> C:\d\artefaktur\extern>ls RRK> acdktest1 acdktest1.rar acdkx_servlet RRK> C:\d\artefaktur\extern>..\acdk\bin\acdkmc_d acdktest1 RRK> I: Analyse file: C:\d\artefaktur\extern\acdktest1\acdktest1.h RRK> I: Analyse file: C:\d\artefaktur\extern\acdktest1\NewObjects.h RRK> C:\d\artefaktur\extern> RRK> This will generate 2 cpp files. Add the files to the project. RRK> Then you will receive the results you expected. RRK> See also: RRK> http://acdk.sourceforge.net/acdk/docs/hb/lang/acdk_hb_dmi_server_objects.htm RRK> l RRK> And RRK> http://acdk.sourceforge.net/acdk/docs/hb/lang/acdk_hb_mi.html RRK> The corrected version is included in this mail. RRK> Hope this helps. RRK> Roger RRK> -----Ursprüngliche Nachricht----- RRK> Von: acd...@li... RRK> [mailto:acd...@li...] Im Auftrag von Miroslav RRK> Nachev RRK> Gesendet: Freitag, 10. Juni 2005 14:58 RRK> An: Roger Rene Kommer RRK> Cc: acd...@li... RRK> Betreff: Re: AW: [Acdk-developer] Compiling problem RRK> Dear Roger, RRK> Can you check the attached code with the project settings? I try your RRK> suggestions but without success. Just 1st, the 2nd I can't understand. RRK> When I start the same application I found the following problems: RRK> 1. System::out->println(this->getClass()->getName()); RRK> The result of this is "acdk::lang::Object". RRK> I expect to be "NewObjects". RRK> 2. This code can't be runned: RRK> RStringBuffer sb1 = new StringBuffer("M"); RRK> RStringBuffer sb2 = sb1->clone(); RRK> Best Regards, RRK> Miroslav Nachev |