Quantcast

Rebuild Oct file does not change the executable

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Rebuild Oct file does not change the executable

Thomas D. Dean-2
I rebuild an .oct file but, execution does not change the results.

#include <octave/oct.h>
#include <octave/oct-map.h>

DEFUN_DLD (create_struct_array, , ,
                   "example of struct array")
{
   octave_idx_type n = 3;

   Cell avals (n, 1);
   Cell bvals (n, 1);

   for (octave_idx_type i = 0; i < n; i++)
        {
          avals(i) = i*7;
          bvals(i) = i+1;
        }

   octave_map m;

   m.assign ("a", avals);
   m.assign ("b", bvals);

   return octave_value (m);
}

The above courtsey of jwe

mkoctfile create_struct_array.cpp

creates create_struct_array.oct

octave:124> m=create_struct_array()
m =

   3x1 struct array containing the fields:

     a
     b

Changing the value of n to n = 8 and saving the file,

mkoctfile create_struct_array.cpp

creates create_struct_array.oct with a new timestamp

octave:125> m=create_struct_array()
warning: library /home/tomdean/Math/Octave/work/create_struct_array.oct
not reloaded due to existing references
m =

   3x1 struct array containing the fields:

     a
     b

Seems like octave is keeping the old version in a buffer?

If I delete the .oct file and within octave try to call it, I get the
expected error message.  Then, recompiling uses the new version.

Any ideas?

_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Rebuild Oct file does not change the executable

siko1056

Thomas D. Dean-2 wrote
I rebuild an .oct file but, execution does not change the results.

#include <octave/oct.h>
#include <octave/oct-map.h>

DEFUN_DLD (create_struct_array, , ,
                   "example of struct array")
{
   octave_idx_type n = 3;

   Cell avals (n, 1);
   Cell bvals (n, 1);

   for (octave_idx_type i = 0; i < n; i++)
        {
          avals(i) = i*7;
          bvals(i) = i+1;
        }

   octave_map m;

   m.assign ("a", avals);
   m.assign ("b", bvals);

   return octave_value (m);
}

The above courtsey of jwe

mkoctfile create_struct_array.cpp

creates create_struct_array.oct

octave:124> m=create_struct_array()
m =

   3x1 struct array containing the fields:

     a
     b

Changing the value of n to n = 8 and saving the file,

mkoctfile create_struct_array.cpp

creates create_struct_array.oct with a new timestamp

octave:125> m=create_struct_array()
warning: library /home/tomdean/Math/Octave/work/create_struct_array.oct
not reloaded due to existing references
m =

   3x1 struct array containing the fields:

     a
     b

Seems like octave is keeping the old version in a buffer?

If I delete the .oct file and within octave try to call it, I get the
expected error message.  Then, recompiling uses the new version.

Any ideas?
Yes, just type:

>> clear create_struct_array; mkoctfile create_struct_array.cpp

to get a "fresh" oct file.

HTH, Kai
Loading...