Scilab: wrap SWIG_Init() function to initialize module SWIG types (needed for STL support)
This commit is contained in:
parent
627e4002fe
commit
3dd0ebdde9
2 changed files with 34 additions and 9 deletions
|
|
@ -230,11 +230,34 @@ SwigScilabRaise(const char *type) {
|
|||
|
||||
%}
|
||||
|
||||
//%insert(init) "swiginit.swg"
|
||||
%init %{
|
||||
/* -----------------------------------------------------------------------------*
|
||||
* Partial Init method
|
||||
* -----------------------------------------------------------------------------*/
|
||||
%insert("init")
|
||||
%{
|
||||
|
||||
#define SWIG_GetModule(clientdata) SWIG_Scilab_GetModule()
|
||||
#define SWIG_SetModule(clientdata, pointer) SWIG_Scilab_SetModule(pointer)
|
||||
|
||||
SWIGRUNTIME swig_module_info*
|
||||
SWIG_Scilab_GetModule(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
SWIGRUNTIME void
|
||||
SWIG_Scilab_SetModule(swig_module_info *swig_module)
|
||||
{
|
||||
}
|
||||
|
||||
SWIGEXPORT int SWIG_init(void) {
|
||||
%}
|
||||
|
||||
%insert(init) "swiginit.swg"
|
||||
|
||||
%init %{
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
int SWIG_Init(char *fname, unsigned long fname_len) {
|
||||
SWIG_InitializeModule(NULL);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
%}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue