Lailton Fernando Mariano
unread,Dec 11, 2025, 1:48:22 PM (3 days ago) Dec 11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Harbour Developers
Aleksander,
What do you think about send a third parameter to set filename?
cBuffer ( from hb_compileFromBuf )
pCode := hb_hrbLoad( cBuffer, cFileName )
```
HB_FUNC( HB_HRBLOAD )
{
HB_USHORT usMode = HB_HRB_BIND_DEFAULT;
HB_USHORT nParam = 1;
HB_SIZE nLen;
if( HB_ISNUM( 1 ) )
{
usMode = ( HB_USHORT ) hb_parni( 1 );
nParam++;
}
nLen = hb_parclen( nParam );
if( nLen > 0 )
{
const char * fileOrBody = hb_parc( nParam );
PHRB_BODY pHrbBody;
if( hb_hrbCheckSig( fileOrBody, nLen ) != 0 )
{
const char * szFileName = NULL;
if( hb_pcount() > nParam && HB_ISCHAR( nParam + 1 ) )
{
szFileName = hb_parc( nParam + 1 );
nParam++;
}
pHrbBody = hb_hrbLoad( fileOrBody, nLen, usMode, szFileName );
}
else
pHrbBody = hb_hrbLoadFromFile( fileOrBody, usMode );
if( pHrbBody )
{
int iPCount = hb_pcount() - nParam;
PHB_ITEM * pParams = NULL;
if( iPCount > 0 )
{
int i;
pParams = ( PHB_ITEM * ) hb_xgrab( sizeof( PHB_ITEM ) * iPCount );
for( i = 0; i < iPCount; i++ )
pParams[ i ] = hb_stackItemFromBase( i + 1 + nParam );
}
hb_hrbInit( pHrbBody, iPCount, pParams );
if( pParams )
hb_xfree( pParams );
}
hb_hrbReturn( pHrbBody );
}
else
hb_errRT_BASE( EG_ARG, 9998, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
} ```