← Back to team overview

kicad-developers team mailing list archive

[PATCH 05/11] Correct import/export of KIFACE_GETTER.

 

This function is passed through a DLL interface, so users need to be aware
that they need to generate import stubs on Windows. Implicit generation of
stubs for undefined functions is an extension of the GNU toolchain.
---
 include/kiway.h | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/include/kiway.h b/include/kiway.h
index 406ab91..0d6c097 100644
--- a/include/kiway.h
+++ b/include/kiway.h
@@ -416,6 +416,9 @@ inline KIWAY* PrjToKiway( PROJECT* aProject )
 extern KIWAY Kiway;     // provided by single_top.cpp and kicad.cpp
 
 
+/// No name mangling.  Each KIFACE (DSO/DLL) will implement this once.
+extern "C" {
+
 /**
  * Function Pointer KIFACE_GETTER_FUNC
  * points to the one and only KIFACE export.  The export's address
@@ -429,10 +432,12 @@ extern KIWAY Kiway;     // provided by single_top.cpp and kicad.cpp
  * @param aProgram is a pointer to the PGM_BASE for this process.
  * @return KIFACE* - unconditionally, cannot fail.
  */
+
 typedef     KIFACE*  KIFACE_GETTER_FUNC( int* aKIFACEversion, int aKIWAYversion, PGM_BASE* aProgram );
 
-/// No name mangling.  Each KIFACE (DSO/DLL) will implement this once.
-extern "C" KIFACE* KIFACE_GETTER(  int* aKIFACEversion, int aKIWAYversion, PGM_BASE* aProgram );
+MY_API( KIFACE* ) KIFACE_GETTER(  int* aKIFACEversion, int aKIWAYversion, PGM_BASE* aProgram );
+
+}
 
 
 #endif  // KIWAY_H_

Follow ups

References