Scilab: init function name SWIG_Init() changed to <module>_Init()
This commit is contained in:
parent
109c65f52f
commit
77da84f549
7 changed files with 22 additions and 20 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
lines(0);
|
lines(0);
|
||||||
ilib_verbose(0);
|
ilib_verbose(0);
|
||||||
exec loader.sce;
|
exec loader.sce;
|
||||||
SWIG_Init();
|
example_Init();
|
||||||
|
|
||||||
printf("\nConstants are wrapped by functions:\n");
|
printf("\nConstants are wrapped by functions:\n");
|
||||||
printf("ICONST = %i (should be 42)\n", ICONST);
|
printf("ICONST = %i (should be 42)\n", ICONST);
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
lines(0);
|
lines(0);
|
||||||
ilib_verbose(0);
|
ilib_verbose(0);
|
||||||
exec loader.sce;
|
exec loader.sce;
|
||||||
SWIG_Init();
|
example_Init();
|
||||||
|
|
||||||
printf("\nTesting use of enums (wrapped as Scilab variables)\n");
|
printf("\nTesting use of enums (wrapped as Scilab variables)\n");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
lines(0);
|
lines(0);
|
||||||
ilib_verbose(0);
|
ilib_verbose(0);
|
||||||
exec loader.sce;
|
exec loader.sce;
|
||||||
SWIG_Init();
|
example_Init();
|
||||||
|
|
||||||
// This example shows how to use C++ fonctions with STL lists arguments
|
// This example shows how to use C++ fonctions with STL lists arguments
|
||||||
// Here, STL lists are converted from/to Scilab matrices (SWIG_SCILAB_EXTRA_NATIVE_CONTAINERS is not defined)
|
// Here, STL lists are converted from/to Scilab matrices (SWIG_SCILAB_EXTRA_NATIVE_CONTAINERS is not defined)
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
lines(0);
|
lines(0);
|
||||||
ilib_verbose(0);
|
ilib_verbose(0);
|
||||||
exec loader.sce;
|
exec loader.sce;
|
||||||
SWIG_Init();
|
example_Init();
|
||||||
|
|
||||||
|
|
||||||
disp(mean([1,2,3,4]));
|
disp(mean([1,2,3,4]));
|
||||||
|
|
|
||||||
|
|
@ -25,10 +25,11 @@ end
|
||||||
|
|
||||||
// Module initialization
|
// Module initialization
|
||||||
try
|
try
|
||||||
SWIG_Init();
|
moduleInit = sprintf("%s_Init()", swigtestname);
|
||||||
|
ierr = execstr(moduleInit);
|
||||||
catch
|
catch
|
||||||
mprintf("*** MODULE INIT FAILED ***\n");
|
mprintf("*** MODULE INIT FAILED ***\n");
|
||||||
exit(1)
|
exit(ierr)
|
||||||
end
|
end
|
||||||
|
|
||||||
// Error management function
|
// Error management function
|
||||||
|
|
|
||||||
|
|
@ -267,12 +267,3 @@ SWIG_Scilab_SetModule(swig_module_info *swig_module)
|
||||||
%}
|
%}
|
||||||
|
|
||||||
%insert(init) "swiginit.swg"
|
%insert(init) "swiginit.swg"
|
||||||
|
|
||||||
%init %{
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C"
|
|
||||||
#endif
|
|
||||||
int SWIG_Init(char *fname, unsigned long fname_len) {
|
|
||||||
SWIG_InitializeModule(NULL);
|
|
||||||
SWIG_CreateScilabVariables();
|
|
||||||
%}
|
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,6 @@ Scilab options (available with -scilab)\n\
|
||||||
-buildflags <file> - Uses a Scilab script in <file> to set build flags\n\
|
-buildflags <file> - Uses a Scilab script in <file> to set build flags\n\
|
||||||
-nobuilder - Do not generate builder script\n\n";
|
-nobuilder - Do not generate builder script\n\n";
|
||||||
|
|
||||||
static const char *SWIG_INIT_FUNCTION_NAME = "SWIG_Init";
|
|
||||||
static const char *SWIG_CREATE_VARIABLES_FUNCTION_NAME = "SWIG_CreateScilabVariables";
|
static const char *SWIG_CREATE_VARIABLES_FUNCTION_NAME = "SWIG_CreateScilabVariables";
|
||||||
|
|
||||||
class SCILAB:public Language {
|
class SCILAB:public Language {
|
||||||
|
|
@ -162,8 +161,12 @@ public:
|
||||||
startBuilderCode(moduleName, outputFilename);
|
startBuilderCode(moduleName, outputFilename);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* add initialization function to builder table */
|
// Module initialization function
|
||||||
addFunctionInBuilder(SWIG_INIT_FUNCTION_NAME, SWIG_INIT_FUNCTION_NAME);
|
String *moduleInitFunctionName = NewString("");
|
||||||
|
Printf(moduleInitFunctionName, "%s_Init", moduleName);
|
||||||
|
|
||||||
|
/* Add initialization function to builder table */
|
||||||
|
addFunctionInBuilder(moduleInitFunctionName, moduleInitFunctionName);
|
||||||
|
|
||||||
// Open Scilab wrapper variables creation function
|
// Open Scilab wrapper variables creation function
|
||||||
variablesCode = NewString("");
|
variablesCode = NewString("");
|
||||||
|
|
@ -189,8 +192,15 @@ public:
|
||||||
saveBuilder();
|
saveBuilder();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Close the init function (opened in sciinit.swg) */
|
// Add initialization function to init section
|
||||||
Printf(initSection, "return 0;\n}\n");
|
Printf(initSection, "#ifdef __cplusplus\n");
|
||||||
|
Printf(initSection, "extern \"C\"\n");
|
||||||
|
Printf(initSection, "#endif\n");
|
||||||
|
Printf(initSection, "int %s(char *fname, unsigned long fname_len) {\n", moduleInitFunctionName);
|
||||||
|
Printf(initSection, " SWIG_InitializeModule(NULL);\n");
|
||||||
|
Printf(initSection, " SWIG_CreateScilabVariables();\n");
|
||||||
|
Printf(initSection, "return 0;\n");
|
||||||
|
Printf(initSection, "}\n");
|
||||||
|
|
||||||
/* Write all to the wrapper file */
|
/* Write all to the wrapper file */
|
||||||
SwigType_emit_type_table(runtimeSection, wrappersSection); // Declare pointer types, ... (Ex: SWIGTYPE_p_p_double)
|
SwigType_emit_type_table(runtimeSection, wrappersSection); // Declare pointer types, ... (Ex: SWIGTYPE_p_p_double)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue