[K42-discussion] static_buf in gentmp

Dilma DaSilva dilma at watson.ibm.com
Thu Jan 4 08:26:32 EST 2007


Donour Sizemore writes:
 > I'm getting linking errors like this:
 > 
[examples removed]

 > That seem to be coming from the code created from gentmp.awk.
 > 
 > -- gentmp.awk --
 > function createStandardFunc()
 > {
 >    ...
 >   
 >   printf("template<> char 
 > %s<INSTNAME>::static_buf[sizeof(%s<INSTNAME>)]\n",TMclass,TMclass)              
 >  > XF;
 >   
 >    ...
 > --
 > 
 > 
 > Does anybody know what the purpose of the static_buf member?
 > 

Donour,

I was not familiar with this "static_buf", but poking around I see that
the generated code for TypeMgrServer (for example in file
powerpc/fullDeb/lib/libc/cobj/tmplTplXTypeMgrServer.I) invokes
    TplMetaTypeMgrServer<INSTNAME> *self = new(static_buf) TplMetaTypeMgrServer<INSTNAME>;
                                                           
and then
    DREFGOBJ(TheTypeMgrRef)->registerTypeHdlr(typeID(), xoh,(uval)self);

This means that method TypeMgr::registerTypeHdlr (in lib/libc/cobj/TypeMgr.C) stores 
the allocated static_buf as "localPtr", which can be retrieved by
method TypeMgr::getTypeLocalPtr (invoked from giveAccessSetClientData
or giveAccessInternal).

What do you have on your generated TplMetaTypeMgrServer.H?

Happy 2007,

Dilma



More information about the K42-discussion mailing list