To me, it could be implemented with one Gambas main program and you SHELL or EXEC to your component Gambas programs. Thus, they're only loaded when they run. When they're done, they're freed.
---------- Original Message ----------- From: Sebi Kul <sebi...@gmail.com> To: mailing list for gambas users <gambas-user@lists.sourceforge.net> Cc: Benoît Minisini <gam...@users.sourceforge.net> Sent: Tue, 10 May 2011 23:04:28 -0300 Subject: Re: [Gambas-user] Dynamically loading components > The reason for doing this is the following: > I'm developing a project which would theoretically have 2 modules, the > base one (the program itself) and the online module, (which adds > synchronization capabilities). Because i would like to keep the classes > inside the Online module hidden, to avoid any security issues (the base > project is subversioned) i am including it as a separate component. > What i would like to do is let the base component look for the online > module, if it finds it, load it, if not, disable the sections in the > GUI that use this functions/classes. > > I managed to remove the compile errors by creating classes in the Base > project with the same name as in the Online component, and inheriting > the corresponding class. I just need to know how to load the component > only if the file exist. > > Thanks all for your help! > > On mar 10 may 2011 21:56:27 ART, Benoît Minisini wrote: > >> Hi! > >> > >> I am using Gambas 3 to develop a modular application. I would like to > >> know if it's possible to load components dynamically (If the component > >> file exist, load it, if not, skip the execution code where the > >> component's functions are called) > >> > >> What I have so far is this: > >> > >> ========== > >> Try Component.Load("daily-school-online.gambas") > >> > >> If Component.IsLoaded("daily-school-online.gambas") Then > >> OnlineModuleLoaded = True > >> Endif > >> ========= > >> > >> But for this to work, I have to add the component as a library on the > >> projects setting dialog, meaning that if the file does not exist, the > >> program wont start. I also have the problem that if I don't add the > >> component as a library, the project wont compile, as the parser will > >> find functions that don't exist on this project, but are declared on the > >> component. > >> > >> Does anybody have any ideas on how to achieve this? > > > > Why do you want to dynamically load components ? > > > > In Gambas, the only reason for doing that is preventing the load of > > unneeded > > shared libraries (i.e. native components). > > > > If you are not in that case, then you can put all your code in the same > > project. Gambas loads a class the first time it is used, so if you don't > > use a > > class, it will never be loaded. > > > > Regards, > > ------------------------------------------------------------------------------ > Achieve unprecedented app performance and reliability > What every C/C++ and Fortran developer should know. > Learn how Intel has extended the reach of its next-generation tools > to help boost performance applications - inlcuding clusters. > http://p.sf.net/sfu/intel-dev2devmay > _______________________________________________ > Gambas-user mailing list > Gambas-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-user ------- End of Original Message ------- ------------------------------------------------------------------------------ Achieve unprecedented app performance and reliability What every C/C++ and Fortran developer should know. Learn how Intel has extended the reach of its next-generation tools to help boost performance applications - inlcuding clusters. http://p.sf.net/sfu/intel-dev2devmay _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user