diff --git a/Doc/Manual/Octave.html b/Doc/Manual/Octave.html index 8a01e7c76..3229299d5 100644 --- a/Doc/Manual/Octave.html +++ b/Doc/Manual/Octave.html @@ -112,6 +112,7 @@ Options specific to the Octave module are: Octave Options (available with -octave) -global - Load all symbols into the global namespace [default] -globals name - Set name used to access C global variables [default: 'cvar'] + - Use '.' to load C global variables into module namespace -noglobal - Do not load all symbols into the global namespace -opprefix str - Prefix str for global operator functions [default: 'op_'] @@ -119,6 +120,7 @@ Octave Options (available with -octave)
The -global and -noglobal options determine whether the Octave module will load all symbols into the global namespace in addition to the global namespace. The -globals option sets the name of the variable which is the namespace for C global variables exported by the module. +The special name "." loads C global variables into the module namespace, i.e. alongside C functions and structs exported by the module. The -opprefix options sets the prefix of the names of global/friend operator functions.
diff --git a/Examples/octave/module_load/runme_args.m b/Examples/octave/module_load/runme_args.m index 271cdd289..716ee31f9 100644 --- a/Examples/octave/module_load/runme_args.m +++ b/Examples/octave/module_load/runme_args.m @@ -38,3 +38,11 @@ example -globals mycvar assert(!isglobal("cvar")) assert(mycvar.ivar == example.ifunc()) ##### END TEST ##### + +clear all; + +##### BEGIN TEST ##### +# load module with root-level cvar +example -globals . +assert(example.ivar == example.ifunc()) +##### END TEST ##### diff --git a/Lib/octave/octruntime.swg b/Lib/octave/octruntime.swg index bb173eb22..1fde2e796 100644 --- a/Lib/octave/octruntime.swg +++ b/Lib/octave/octruntime.swg @@ -33,7 +33,7 @@ DEFUN_DLD (SWIG_name,args,nargout,SWIG_name_d) { if (!already_load) { // parse command line - const char* usage="usage: " SWIG_name_d " [-global|-noglobal] [-globals