On Wed, 09 Dec 2009, Mindaugas Kavaliauskas wrote: Hi,
> > * harbour/contrib/hbmemio/memio.c > > ! declare s_fileFuncs structure as static > > * removed unnecessary code to directly register HB_MEMIO symbol. > > Mindaugas if you need it for some reasons then I can reactivate it > > but I would like to know why it's necessary for you. > Perhaps copy-paste from some of my contrib RDDS. BTW, why RDD has > this in symbol table? It's necessary for *_GETFUNCTABLE function which is accessed from hb_rddRegister() by global symbol table. It's "more or less" Clipper compatible method to register RDD and it's working. If you think it's usable then we can replace it with alternative method which do not use global symbol table. > Another question: many functions of some module are used from > runtime loaded .hrb files. I use REQUEST to force linking this > module into .exe. I current code I need to explicitly request every > function to make it available in .hrb. Is where a way to include all > functions of module into global symbol table? All of the functions > are inside .exe anyway. All non static functions from linked .prg module are automatically registered in global symbol table so I guess you are talking about C code. Here we do not have any information about existing functions if module does not register such list itself using: HB_INIT_SYMBOLS_BEGIN( ... ) [...] HB_INIT_SYMBOLS_END( ... ) Of course module stored in libraries is linked with final application if this application uses at least one of the module's public functions. For core code functions you can use: #include "hbextern.ch" or: REQUEST __HB_EXTERN__ /* force linking symbols by hbextern library */ For you own code you may try to generate such list automatically from standard binaries. F.e. I was using this code to create list of DYNAMIC symbols to include in .HRB files: proc genFuncList() local aFunc, hFile aFunc := getFuncList() asort( aFunc ) hFile := fcreate("dynamic.ch") aeval( aFunc, {|x| fwrite( hFile, "DYNAMIC " + x + hb_osNewLine() ) } ) fclose( hFile ) return func getFuncList() local aFunc, nCount := __dynsCount(), nDst:=0, n aFunc := array( nCount ) for n := 1 to nCount if __dynsIsFun( n ) aFunc[ ++nDst ] := __dynsGetName( n ) endif next asize( aFunc, nDst ) return aFunc You can easy modify it to generate list ofREQUEST-ed functions if you you simply replace "DYNAMIC " with "REQUEST " Tou can even use the same file for both things if you add some header like: #ifdef __HRB__ #define SYM_SCOPE DYNAMIC #else #define SYM_SCOPE REQUEST #endif and then generate list for "SYM_SCOPE ". In the future it will be good to create some tool to manage compiled .hrb files and generate such lists from given .hrb modules. For some C compilers like GCC you can quite easy create simply script which extracts public internal and external function from given .o and .a files using tools like 'nm' But we do not have anything to create such list dynamically during linking. In practice it will be necessary to integrate such code with linker to make it. We can also fully change the method of function encapsulation and register each single function in C code. Such alternative method can be also used to eliminate current startup initialization code. Maybe we will try to make sth like that in the future. best regards, Przemek _______________________________________________ Harbour mailing list (attachment size limit: 40KB) Harbour@harbour-project.org http://lists.harbour-project.org/mailman/listinfo/harbour