summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYungLee <yjlee123@gmail.com>2022-03-15 10:06:17 +0800
committerGitHub <noreply@github.com>2022-03-15 15:06:17 +1300
commit31f7b437f413a3e9c6c71c5c79ba7d3e6b6cc6f5 (patch)
tree1013ce846bb910b985a2c4db22400edb8a783112
parent9efcc785aeae98b8d46b9d5727e4e38311f6b9b1 (diff)
downloadswig-31f7b437f413a3e9c6c71c5c79ba7d3e6b6cc6f5.tar.gz
[scilab] Fix to work on Windows
* Change the builder filename to match the loader filename * Mark extern functions with SWIGEXPORT * Fix bug: builder.sce not generated if with '-scilab -builder' option Fixes #1853
-rw-r--r--Lib/scilab/scirun.swg4
-rw-r--r--Lib/scilab/sciruntime.swg2
-rw-r--r--Source/Modules/scilab.cxx22
3 files changed, 15 insertions, 13 deletions
diff --git a/Lib/scilab/scirun.swg b/Lib/scilab/scirun.swg
index 2e4084c15..586d5f16f 100644
--- a/Lib/scilab/scirun.swg
+++ b/Lib/scilab/scirun.swg
@@ -434,7 +434,7 @@ SWIG_Scilab_NewMemberObj(void *pvApiCtx, int iVarOut, void *ptr, int sz, swig_ty
#ifdef __cplusplus
extern "C"
#endif
-int SWIG_this(SWIG_GatewayParameters) {
+SWIGEXPORT int SWIG_this(SWIG_GatewayParameters) {
void *ptrValue = NULL;
if (SwigScilabPtrToObject(pvApiCtx, 1, &ptrValue, NULL, 0, fname) == SWIG_OK) {
SWIG_Scilab_SetOutputPosition(1);
@@ -451,7 +451,7 @@ int SWIG_this(SWIG_GatewayParameters) {
#ifdef __cplusplus
extern "C"
#endif
-int SWIG_ptr(SWIG_GatewayParameters) {
+SWIGEXPORT int SWIG_ptr(SWIG_GatewayParameters) {
if (SWIG_NbInputArgument(pvApiCtx) > 0) {
SciErr sciErr;
int *piAddrVar1 = NULL;
diff --git a/Lib/scilab/sciruntime.swg b/Lib/scilab/sciruntime.swg
index a2c11d708..e772926f7 100644
--- a/Lib/scilab/sciruntime.swg
+++ b/Lib/scilab/sciruntime.swg
@@ -40,7 +40,7 @@ SWIG_Scilab_TypeQuery(const char *name) {
#ifdef __cplusplus
extern "C"
#endif
-int SWIG_<module>_Init(SWIG_GatewayParameters) {
+SWIGEXPORT int SWIG_<module>_Init(SWIG_GatewayParameters) {
SWIG_InitializeModule(NULL);
SWIG_CreateScilabVariables(pvApiCtx);
swig_module_initialized = 1;
diff --git a/Source/Modules/scilab.cxx b/Source/Modules/scilab.cxx
index 49f2e778c..1731b218c 100644
--- a/Source/Modules/scilab.cxx
+++ b/Source/Modules/scilab.cxx
@@ -252,7 +252,7 @@ public:
// Add Builder footer code and save
if (generateBuilder) {
- saveBuilderFile(gatewayName);
+ saveBuilderFile(gatewayLibraryName);
}
/* Close the init function and rename with module name */
@@ -345,7 +345,7 @@ public:
}
/* Write the wrapper function definition (standard Scilab gateway function prototype) */
- Printv(wrapper->def, "int ", overloadedName, "(SWIG_GatewayParameters) {", NIL);
+ Printv(wrapper->def, "SWIGEXPORT int ", overloadedName, "(SWIG_GatewayParameters) {", NIL);
/* Emit all of the local variables for holding arguments */
// E.g.: double arg1;
@@ -556,7 +556,7 @@ public:
String *dispatch = Swig_overload_dispatch(node, "return %s(SWIG_GatewayArguments);", &maxargs);
String *tmp = NewString("");
- Printv(wrapper->def, "int ", wrapperName, "(SWIG_GatewayParameters) {\n", NIL);
+ Printv(wrapper->def, "SWIGEXPORT int ", wrapperName, "(SWIG_GatewayParameters) {\n", NIL);
/* Get the number of the parameters */
Wrapper_add_local(wrapper, "argc", "int argc = SWIG_NbInputArgument(pvApiCtx)");
@@ -600,7 +600,7 @@ public:
String *scilabGetSmallFunctionName = Swig_name_get(NSPACE_TODO, smallVariableName);
Setattr(node, "wrap:name", getFunctionName);
- Printv(getFunctionWrapper->def, "int ", getFunctionName, "(SWIG_GatewayParameters) {\n", NIL);
+ Printv(getFunctionWrapper->def, "SWIGEXPORT int ", getFunctionName, "(SWIG_GatewayParameters) {\n", NIL);
/* Check the number of input and output */
Printf(getFunctionWrapper->def, "SWIG_CheckInputArgument(pvApiCtx, 0, 0);\n");
@@ -630,7 +630,7 @@ public:
String *scilabSetSmallFunctionName = Swig_name_set(NSPACE_TODO, smallVariableName);
Setattr(node, "wrap:name", setFunctionName);
- Printv(setFunctionWrapper->def, "int ", setFunctionName, "(SWIG_GatewayParameters) {\n", NIL);
+ Printv(setFunctionWrapper->def, "SWIGEXPORT int ", setFunctionName, "(SWIG_GatewayParameters) {\n", NIL);
/* Check the number of input and output */
Printf(setFunctionWrapper->def, "SWIG_CheckInputArgument(pvApiCtx, 1, 1);\n");
@@ -714,7 +714,7 @@ public:
String *scilabGetSmallFunctionName = Swig_name_get(NSPACE_TODO, smallConstantName);
Setattr(node, "wrap:name", getFunctionName);
Setattr(node, "wrap:name", getFunctionName);
- Printv(getFunctionWrapper->def, "int ", getFunctionName, "(SWIG_GatewayParameters) {\n", NIL);
+ Printv(getFunctionWrapper->def, "SWIGEXPORT int ", getFunctionName, "(SWIG_GatewayParameters) {\n", NIL);
/* Check the number of input and output */
Printf(getFunctionWrapper->def, "SWIG_CheckInputArgument(pvApiCtx, 0, 0);\n");
@@ -830,6 +830,8 @@ public:
builderFunctionCount = 0;
builderCode = NewString("");
+ builderCode5 = NewString("");
+ builderCode6 = NewString("");
Printf(builderCode, "mode(-1);\n");
Printf(builderCode, "lines(0);\n"); /* Useful for automatic tests */
@@ -933,8 +935,8 @@ public:
Printf(builderCode, "if ierr <> 0 then\n");
Printf(builderCode, " error(ierr, err_msg);\n");
Printf(builderCode, "end\n");
- Write(builderFile, builderCode, Len(builderCode));
-
+ Printv(builderFile, builderCode, NIL);
+
Delete(builderCode);
Delete(builderFile);
}
@@ -998,7 +1000,7 @@ public:
Printf(gatewayHeaderV6, "#ifdef __cplusplus\n");
Printf(gatewayHeaderV6, "extern \"C\"\n");
Printf(gatewayHeaderV6, "#endif\n");
- Printf(gatewayHeaderV6, "int %s(wchar_t *pwstFuncName) {\n", gatewayLibraryName);
+ Printf(gatewayHeaderV6, "SWIGEXPORT int %s(wchar_t *pwstFuncName) {\n", gatewayLibraryName);
Printf(gatewayHeaderV6, "\n");
}
@@ -1029,7 +1031,7 @@ public:
Printf(gatewayHeaderV5, "#ifdef __cplusplus\n");
Printf(gatewayHeaderV5, "extern \"C\" {\n");
Printf(gatewayHeaderV5, "#endif\n");
- Printf(gatewayHeaderV5, "int C2F(%s)() {\n", gatewayLibraryName);
+ Printf(gatewayHeaderV5, "SWIGEXPORT int C2F(%s)() {\n", gatewayLibraryName);
Printf(gatewayHeaderV5, " Rhs = Max(0, Rhs);\n");
Printf(gatewayHeaderV5, " if (*(Tab[Fin-1].f) != NULL) {\n");
Printf(gatewayHeaderV5, " if(pvApiCtx == NULL) {\n");