[bug #68432] Example code globaldemo.cc no longer compiles with mkoctfile
"Dmitri A. Sergatskov" <[email protected]> Tue, 9 Jun 2026 18:26:18 -0400 (EDT)
| Newsgroups | gmane.comp.gnu.octave.bugs |
|---|---|
| Message-ID | <[email protected]> |
Please use the bug tracker to post updates to a bug report. The mailing list is intended as a read-only notification stream. Info posted to this mailing list address won't appear in the tracker database where it is most useful.
Follow-up Comment #3, bug #68432 (group octave):
I can compile it with this change:
% hg diff
diff -r cce6f2068b46 examples/code/globaldemo.cc
--- a/examples/code/globaldemo.cc Mon Mar 03 09:21:08 2025 +0100
+++ b/examples/code/globaldemo.cc Tue Jun 09 17:59:54 2026 -0400
@@ -10,16 +10,14 @@
std::string s = args(0).string_value ();
- octave::symbol_table& symtab = interp.get_symbol_table ();
-
- octave_value tmp = symtab.global_varval (s);
+ octave_value tmp = interp.global_varval (s);
if (tmp.is_defined ())
retval = tmp;
else
retval = "Global variable not found";
- symtab.global_assign ("a", 42.0);
+ interp.global_assign ("a", 42.0);
return retval;
}
(The code could probably made more user friendly.)
% mkoctfile --verbose globaldemo.cc
clang++ -std=gnu++20 -Wno-implicit-function-declaration -c -F/opt/homebrew/lib
-I/opt/homebrew/include -I/opt/homebrew/opt/libiconv/include
-I/opt/homebrew/opt/readline/include -I/usr/local/include -fPIC
-I/usr/local/include/octave-12.0.0/octave/..
-I/usr/local/include/octave-12.0.0/octave -I/usr/local/include -pthread -g3
-O3 -march=native -flto=thin -Wno-deprecated-declarations globaldemo.cc -o
/var/folders/ds/5xsh6x4914x78jswflyz20c40000gn/T//oct-AKv0V1.o
clang++ -std=gnu++20 -Wno-implicit-function-declaration
-I/usr/local/include/octave-12.0.0/octave/..
-I/usr/local/include/octave-12.0.0/octave -I/usr/local/include -pthread -g3
-O3 -march=native -flto=thin -Wno-deprecated-declarations -o globaldemo.oct
/var/folders/ds/5xsh6x4914x78jswflyz20c40000gn/T//oct-AKv0V1.o -bundle
-undefined dynamic_lookup -bind_at_load -L/usr/local/lib -bundle -undefined
dynamic_lookup -bind_at_load -L/opt/homebrew/lib
-L/opt/homebrew/opt/libiconv/lib -L/opt/homebrew/opt/readline/lib
-L/usr/local/lib -bundle_loader /usr/local/bin/octave-12.0.0
% octave -qf
octave:1> global a
octave:2> a = 101
a = 101
octave:3> globaldemo("a")
ans = 101
octave:4> global b
octave:5> b = 202
b = 202
octave:6> globaldemo("b")
ans = 202
octave:7> globaldemo("c")
ans = Global variable not found
octave:8>
Dmitri.
--
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?68432>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
signature.asc
(application/pgp-signature, 228 B)
-----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQQk97aszIMMAvLLwm6qLAuaBUf3TgUCaiiTCgAKCRCqLAuaBUf3 TmCmAQDiLeZ9NmENN2dYl/HOeqaippLGl16+uZGVhznuVjdCNAD/U3UXe27q9JAb 5excLBzat8Rq1saxH5ByLo4WhlTTSAo= =iVDM -----END PGP SIGNATURE-----