Hi Prezmek,
Sorry to annoy you with thisbut I became crazy.
I was thinking I understanded how it work and tryed to implement a solution
allowing the load and unload of hrb file without changing any structure.
So the idea is the following ;
1) if hb_dynsymFind( pSymbol->szName ) find something,I first change the name
of the actual symbol, replacing it with a string from the new function pointer,
then simply adding the new pSymbol calling hb_dynsymNew( pSymbol ).
The idea is that if we unload the HRB file, I could retrieve the original
Symbol by doing an hb_dynsymNew( "NewName_fromptr" ) and then restoring the
name to the actual name of the unloaded symbol. Doing so, it should work even
in case of many hrb load and unload, despite the load/unload order.
But I never reach to test load/unload as It simply does'nt work.
So, in hb_vmRegisterSymbols(...), when the new function symbol name already
exist (found by hb_dynsymNew()), I first change the name of the actual symbol,
then add the new symbol. If I then check with hb_dynsymNew( ), it return me the
new function symbol, with the good function pointer ...
But, in any case, from the prg point of view, it always launch the function
from the exe :-(
Any idea ?
PS : I also tried to simply replace the actual symbol with the new one with
the same effect ...
PS2 : Trying to just replace the function ptr do cause a GPF :-(
....
if( fPublic )
{
if( fDynLib && HB_VM_ISFUNC( pSymbol ) ) // ok trying to add dynamic
function
{
PHB_DYNS pDynSym;
pDynSym = hb_dynsymFind( pSymbol->szName );
if( pDynSym ) // ok symbol of that name
already exist
{
if( pDynSym->pSymbol != pSymbol && HB_VM_ISFUNC(
pDynSym->pSymbol ) ) // not same symbol pointer
{
if (pSymbol->value.pFunPtr == pDynSym->pSymbol->value.pFunPtr)
// keep actual way if function pointer are the same
{
pSymbol->pDynSym = pDynSym;
pSymbol->scope.value =
( pSymbol->scope.value & ~( HB_FS_PCODEFUNC | HB_FS_LOCAL
) ) |
( pDynSym->pSymbol->scope.value & HB_FS_PCODEFUNC );
pSymbol->value.pFunPtr = pDynSym->pSymbol->value.pFunPtr;
}
else
{
sprintf((char *) szTmp , (const char *) "~%p",
pSymbol->value.pFunPtr) ;
pDynSym->pSymbol->szName = szTmp ; // change the name to a
string created from the new function pointer
printf("Registring: %s:%s scope %04x\r\n", szModuleName,
pSymbol->szName, hSymScope ); fflush(stdout);
printf("Old funct renamed to %s \r\n",
pDynSym->pSymbol->szName ); fflush(stdout);
hb_dynsymNew( pSymbol ); // add new symbol ptr
}
}
else
{
pSymbol->pDynSym = pDynSym;
pDynSym->pSymbol = pSymbol;
}
continue;
...
-----Message d'origine-----
De : [email protected]
[mailto:[email protected]] De la part de Przemyslaw Czerpak
Envoyé : mardi 9 juin 2009 13:12
À : Harbour Project Main Developer List.
Objet : Re: RE: [Harbour] HRB question ??? Possible bug !
On Tue, 09 Jun 2009, J. Lefebvre wrote:
Hi,
> I just have a look at runner.c as dynsym.c but I must admit ...
> I do not see at this time where we actually skip loading symbol
> already existing in exe... :-(
> Could you just point me in the right direction ?
The HRB symbol table is updated inside hb_vmRegisterSymbols() in hvm.c.
Look for hb_dynsymFind().
best regards,
Przemek
_______________________________________________
Harbour mailing list
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour
_______________________________________________
Harbour mailing list
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour