octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: changes to path searching


From: John W. Eaton
Subject: Re: changes to path searching
Date: Fri, 27 Dec 2002 14:52:29 -0600

On 27-Dec-2002, Paul Kienzle <address@hidden> wrote:

| What happens if for example you have logm and sqrtm in the same
| oct-file on the system path and you put an m-file logm before it
| on the path?  Do you still search through the loaded oct-files
| before checking the path?

The current search is performed like this (load_fcn_from_file in
parse.y):

  ...

  static string_vector names (2);

  names[0] = nm + ".oct";
  names[1] = nm + ".m";

  std::string file
   = octave_env::make_absolute (Vload_path_dir_path.find_first_of (names),
                                octave_env::getcwd ());

  int len = file.length ();

  if (file.substr (len-4, len-1) == ".oct")
    {
      // Load the .oct file.  Previous versions of Octave only pass nm
      // (the function name) to the loader.  Now we also pass the
      // filename where we expect to find the symbol.

      if (octave_dynamic_loader::load (nm, file))
        force_link_to_function (nm);
    }
  else
    {
      // ... load the M-file.


In octave_dynamic_loader::load, we search the currently loaded .oct
files for the symbol before actually loading the file, so yes, I think
this is still a problem.  I suppose that instead of searching all the
currently loaded .oct files, we should only search the one that we are
currently loading (if it has already been loaded) otherwise, load it
and search.  This requires maintaining a list of filename to dynamic
library handles in the dynamic loader module, but that is easy enough
to do.  Would that solve the problem?

jwe



reply via email to

[Prev in Thread] Current Thread [Next in Thread]