Scilab: wrap SWIG_Init() function to initialize module SWIG types (needed for STL support)

This commit is contained in:
Simon Marchetto 2013-07-17 16:31:34 +02:00
commit 3dd0ebdde9
2 changed files with 34 additions and 9 deletions

View file

@ -22,6 +22,8 @@ Scilab Options (available with -scilab)\n\
-addcflag - Additionnal path to includes for builder.sce file (Ex: -I/usr/includes/)\n\
-addldlag - Additionnal library flag for builder.sce file (Ex: -lm)\n\n";
const char* SWIG_INIT_FUNCTION_NAME = "SWIG_Init";
class SCILAB : public Language {
protected:
/* General objects used for holding the strings */
@ -174,6 +176,9 @@ public:
Printf(builderCode, "table = [");
/* Add initialization function to builder table */
Printf(builderCode, "\"%s\",\"%s\";", SWIG_INIT_FUNCTION_NAME, SWIG_INIT_FUNCTION_NAME);
/* Emit code for children */
if (CPlusPlus) {
Printf(wrappersSection, "extern \"C\" {\n");
@ -201,9 +206,6 @@ public:
Close(builderFile);
Delete(builderFile);
/* Close the init function and quit (opened in sciruntime.swg) */
Printf(initSection, "return 0;\n}\n");
/* Write all to the wrapper file */
SwigType_emit_type_table(runtimeSection, wrappersSection); // Declare pointer types, ... (Ex: SWIGTYPE_p_p_double)
Dump(runtimeSection, beginSection);