FarStandartFunctions persistance

A place where plug-in developers can share their knowledge and experience.
Locked
techie
Posts: 28
Joined: Thu Feb 23, 2006 8:11 pm

FarStandartFunctions persistance

Post by techie »

From API reference in SetStartupInfo page
If the plugin uses "standard functions" from the FarStandardFunctions structure then the PluginStartupInfo.FSF member must be copied to an internal variable for further usage:
static struct PluginStartupInfo Info;
static struct FarStandardFunctions FSF;

void _export SetStartupInfo(struct PluginStartupInfo *psInfo)
{
Info=*psInfo;
FSF=*psInfo->FSF;
Info.FSF=&FSF; // adjust the address in the local variable
...
}
Is it really necessary to copy FSF structure? Isn't this table static with it's address fixed in address space of Far, is it? Or this table is created temporary like PluginStartupInfo structure, which is passed to SetStartupInfo?
User avatar
t-rex
Admin
Posts: 417
Joined: Sun Mar 20, 2005 6:10 pm
Location: Ashdod
Contact:

Post by t-rex »

techie
It's a temporary var - for safety issues.
techie
Posts: 28
Joined: Thu Feb 23, 2006 8:11 pm

Post by techie »

By var you mean FARSTANDARDFUNCTIONS structure, right?

If I understand this correctly, FSF in PluginStartupInfo structure holds the address of FARSTANDARDFUNCTIONS structure. So, when you copy PluginStartupInfo the address stays the same.
User avatar
t-rex
Admin
Posts: 417
Joined: Sun Mar 20, 2005 6:10 pm
Location: Ashdod
Contact:

Post by t-rex »

techie
FSF & PSI are both temporary and should be copied to internal structures.
Locked