Avoid conflicting declaration for Pgm()
This function has two conflicting definitions in the "kicad" executable and the other wrapper programs. As the kifaces can be loaded from either, this silently assumes compatible data layout for the PGM_KICAD and PGM_BASE types when passed by reference, which is valid only when the compiler is aware of the cast. If the return type is encoded in the symbol name (such as when using the MSVC compiler), this also causes an error during linking, as the symbol names no longer match.
This commit is contained in:
parent
92a3743590
commit
b9a6c4988f
|
@ -364,9 +364,7 @@ protected:
|
|||
};
|
||||
|
||||
|
||||
#if !defined(PGM_KICAD_H_) // PGM_KICAD has an alternate
|
||||
/// The global Program "get" accessor.
|
||||
extern PGM_BASE& Pgm();
|
||||
#endif
|
||||
|
||||
#endif // PGM_BASE_H_
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
void KICAD_MANAGER_FRAME::OnFileHistory( wxCommandEvent& event )
|
||||
{
|
||||
wxString fn = GetFileFromHistory( event.GetId(),
|
||||
_( "KiCad project file" ), &Pgm().GetFileHistory() );
|
||||
_( "KiCad project file" ), &PgmTop().GetFileHistory() );
|
||||
|
||||
if( fn.size() )
|
||||
{
|
||||
|
|
|
@ -58,7 +58,14 @@ KIFACE_I& Kiface()
|
|||
|
||||
static PGM_KICAD program;
|
||||
|
||||
PGM_KICAD& Pgm()
|
||||
|
||||
PGM_BASE& Pgm()
|
||||
{
|
||||
return program;
|
||||
}
|
||||
|
||||
|
||||
PGM_KICAD& PgmTop()
|
||||
{
|
||||
return program;
|
||||
}
|
||||
|
|
|
@ -119,7 +119,7 @@ KICAD_MANAGER_FRAME::~KICAD_MANAGER_FRAME()
|
|||
|
||||
wxConfigBase* KICAD_MANAGER_FRAME::config()
|
||||
{
|
||||
wxConfigBase* ret = Pgm().PgmSettings();
|
||||
wxConfigBase* ret = PgmTop().PgmSettings();
|
||||
wxASSERT( ret );
|
||||
return ret;
|
||||
}
|
||||
|
@ -181,13 +181,13 @@ void KICAD_MANAGER_FRAME::ReCreateTreePrj()
|
|||
|
||||
const SEARCH_STACK& KICAD_MANAGER_FRAME::sys_search()
|
||||
{
|
||||
return Pgm().SysSearch();
|
||||
return PgmTop().SysSearch();
|
||||
}
|
||||
|
||||
|
||||
wxString KICAD_MANAGER_FRAME::help_name()
|
||||
{
|
||||
return Pgm().GetHelpFileName();
|
||||
return PgmTop().GetHelpFileName();
|
||||
}
|
||||
|
||||
|
||||
|
@ -212,7 +212,7 @@ void KICAD_MANAGER_FRAME::OnCloseWindow( wxCloseEvent& Event )
|
|||
{
|
||||
int px, py;
|
||||
|
||||
UpdateFileHistory( GetProjectFileName(), &Pgm().GetFileHistory() );
|
||||
UpdateFileHistory( GetProjectFileName(), &PgmTop().GetFileHistory() );
|
||||
|
||||
if( !IsIconized() ) // save main frame position and size
|
||||
{
|
||||
|
|
|
@ -201,7 +201,7 @@ void KICAD_MANAGER_FRAME::ReCreateMenuBar()
|
|||
// Before deleting, remove the menus managed by m_fileHistory
|
||||
// (the file history will be updated when adding/removing files in history)
|
||||
if( openRecentMenu )
|
||||
Pgm().GetFileHistory().RemoveMenu( openRecentMenu );
|
||||
PgmTop().GetFileHistory().RemoveMenu( openRecentMenu );
|
||||
|
||||
// Delete all existing menus
|
||||
while( menuBar->GetMenuCount() )
|
||||
|
@ -220,8 +220,8 @@ void KICAD_MANAGER_FRAME::ReCreateMenuBar()
|
|||
|
||||
// File history
|
||||
openRecentMenu = new wxMenu();
|
||||
Pgm().GetFileHistory().UseMenu( openRecentMenu );
|
||||
Pgm().GetFileHistory().AddFilesToMenu( );
|
||||
PgmTop().GetFileHistory().UseMenu( openRecentMenu );
|
||||
PgmTop().GetFileHistory().AddFilesToMenu( );
|
||||
AddMenuItem( fileMenu, openRecentMenu,
|
||||
wxID_ANY,
|
||||
_( "Open &Recent" ),
|
||||
|
|
|
@ -72,6 +72,7 @@ protected:
|
|||
};
|
||||
|
||||
|
||||
extern PGM_KICAD& Pgm();
|
||||
extern PGM_KICAD& PgmTop();
|
||||
|
||||
|
||||
#endif // PGM_KICAD_H_
|
||||
|
|
|
@ -161,7 +161,7 @@ void KICAD_MANAGER_FRAME::CreateNewProject( const wxString& aPrjFullFileName,
|
|||
|
||||
// Write settings to project file
|
||||
// was: wxGetApp().WriteProjectConfig( aPrjFullFileName, GeneralGroupName, s_KicadManagerParams );
|
||||
Prj().ConfigSave( Pgm().SysSearch(), GeneralGroupName, s_KicadManagerParams );
|
||||
Prj().ConfigSave( PgmTop().SysSearch(), GeneralGroupName, s_KicadManagerParams );
|
||||
|
||||
// Ensure a "stub" for a schematic root sheet and a board exist.
|
||||
// It will avoid messages from the schematic editor or the board editor to create a new file
|
||||
|
@ -324,7 +324,7 @@ void KICAD_MANAGER_FRAME::OnLoadProject( wxCommandEvent& event )
|
|||
m_MessagesBox->Clear();
|
||||
}
|
||||
|
||||
Prj().ConfigLoad( Pgm().SysSearch(), GeneralGroupName, s_KicadManagerParams );
|
||||
Prj().ConfigLoad( PgmTop().SysSearch(), GeneralGroupName, s_KicadManagerParams );
|
||||
|
||||
title = wxT( "KiCad " ) + GetBuildVersion() + wxT( ' ' ) + prj_filename;
|
||||
|
||||
|
@ -336,7 +336,7 @@ void KICAD_MANAGER_FRAME::OnLoadProject( wxCommandEvent& event )
|
|||
SetTitle( title );
|
||||
|
||||
if( !prj_filename.IsSameAs( nameless_prj ) )
|
||||
UpdateFileHistory( prj_filename, &Pgm().GetFileHistory() );
|
||||
UpdateFileHistory( prj_filename, &PgmTop().GetFileHistory() );
|
||||
|
||||
m_LeftWin->ReCreateTreePrj();
|
||||
|
||||
|
@ -385,7 +385,7 @@ void KICAD_MANAGER_FRAME::OnSaveProject( wxCommandEvent& event )
|
|||
|
||||
// was: wxGetApp().WriteProjectConfig( m_ProjectFileName.GetFullPath(),
|
||||
// GeneralGroupName, s_KicadManagerParams );
|
||||
Prj().ConfigSave( Pgm().SysSearch(), GeneralGroupName, s_KicadManagerParams );
|
||||
Prj().ConfigSave( PgmTop().SysSearch(), GeneralGroupName, s_KicadManagerParams );
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue