help-octave
[Top][All Lists]
Advanced

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

Re: Octave/Matlab gcc front end?


From: John Eaton
Subject: Re: Octave/Matlab gcc front end?
Date: Wed, 13 Sep 1995 20:00:16 -0500

Ted Harding <address@hidden> wrote:

: May I ask a naive question? In Matlab, the MEX file mechanism, though
: needing some care, works very straightforwardly.

It is currently possible (though not well documented or particularly
well tested) to do essentially the same thing with Octave, provided
that you have dld available.  To make this work for other systems that
don't have dld but do have some other method of dynamic linking should
not be too hard, but like everything else, it takes time and there are
lots of other things in the PROJECTS file and in my list of pending
bug reports and other messages...

: Now my naive question is: If it is this simple in DOS/Matlab, why does it
: seem to be so problematic with UNIX/octave, with fuss about dld etc?

I don't see that there is much difference.  What you don't see in the
DOS/Matlab code is what Matlab actually has to do to link to the .mex
file.  With Octave, you can see what is required.  The code is in the
file src/dynamic-ld.cc (the glue between Octave and any dynamic
linking subroutines) and in the dld subdirectory (the code for all the
actual dirty work).

The dynamic-ld.cc file currently has the following code:

  Octave_builtin_fcn
  load_octave_builtin (const char *name)
  {
  #ifdef WITH_DLD
    return dld_octave_builtin (name);
  #else
    return 0;
  #endif
  }

  int
  load_octave_oct_file (const char *name)
  {
  #ifdef WITH_DLD
    return dld_octave_oct_file (name);
  #endif
    return 0;
  }

  void
  init_dynamic_linker (void)
  {
  #ifdef WITH_DLD
    octave_dld_init ();
  #endif
  }

along with the definitions of octave_dld_init(), dld_octave_oct_file(),
and dld_octave_builtin().

It should be possible to make dynamic linking work with some mechanism
other than dld simply by adding new cases to the functions shown
above, implementing the necessary functions corresponding to the ones
for dld, and possibly changing the configuration to build the right
kinds of objects/libraries for dynamic linking of the `builtin'
functions.  It would probably even be possible to support more than
one kind of dynamic linking on the same platform if that would be
useful.

jwe


reply via email to

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