From: Phil K. <ph...@ne...> - 2009-03-26 05:59:00
|
Hi, On Wed, Mar 25, 2009 at 11:58 PM, Przemyslaw Czerpak <dr...@ac...> wrote: > I see that you are using static Harbour functions inside > #pragma begindump C code and then preprocess generated .c > files with sed to convert declarations from HB_FUNC_EXTERN() > to HB_FUNC_STATIC(). > It effectively blocks using hbcmp directly to compile .prg files > to .o ones so it's still necessary to define HB_INC_INSTALL and > HB_LIB_INSTALL. > It will be much easier to use only [x]hbcmp and [x]hbcc/[x]hblnk > just like in xHGtk without setting any external variables. Yes I have this problem. Also, line numbers in PCODE after #enddump are off-by-one. Actually, I would prefer to drop begindump usage and declare classes in C, but we don't have a well enough C classes API for this. > You can also make small trick to increase a little bit the compilation > speed by reducing number of calls to pkg-config. > Instead of: > GTK_CFLAGS = `pkg-config --cflags gtk+-2.0` > you can use: > GTK_CFLAGS := $(shell pkg-config --cflags gtk+-2.0) > It should cause that pkg-config will be executed only once in the above > line instead of calling it in each rule. Yes, I know, just it didn't look too slow to me ;) I will add it. > But to use [x]hb* scripts only (or hbmk2 in the future) it's necessary > to resolve the problem with static Harbour functions inside #pragma > {begin,end}dump in .prg files and eliminate sed. > I do not like it but I cannot give you any reasonable alternative so > I'll add to Harbour some very simple support for detecting such functions > though it will work in a little bit different way then in xHarbour. > It will only look for static functions used also in .prg code and will > make some basic tokenization to eliminate comments, strings and operate > only on whole words. However it will not know anything about C syntax > and C preprocessing so it will not work correctly for code like: > #if 0 > HB_FUNC_STATIC( MYFUNC ) > #else > HB_FUNC( MYFUNC ) > #endif > { > hb_retc( "MyFunc" ); > } > but for xbgtk and probably 99% of other cases it's enough. How many other cases do you know BTW? > Seems that > it's better/safer solution then external updating of generated .c files. I'm not sure it's safer, because I generate these files and know exactly what kind of code they contain. Rather than this hack I would prefer a C-level classes API, which would allow me to define a class with its superclasses, multiple constructors. Not using begindump. But I understand that an API should be carefully designed, and so - thanks at least for the hack. > There is still open the question about localization of final libraries > in make install but I think we can resolve it by adding new switch > to hb* scripts, f.e. --hblibdir so they can be used just like pkg-config: > HB_LIB_INSTALL := $(shell hbmk --hblibdir) > HB_INC_INSTALL := $(shell hbmk --hbincdir) It would be a really nice feature! -- Ph. |