help-octave
[Top][All Lists]
Advanced

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

problem with dld example


From: Jeppe Sigbrandt
Subject: problem with dld example
Date: Wed, 3 Jul 1996 23:23:39 +0100

Hello,

Am interested in using dynamic loading with Octave.
Downloaded, compiled & installed dld-3.3 for Linux a.out.
Tried to compile example program in section 5.8 of documentation:

# g++ -I/mnt/jay/octave-1.1.1/src -I/mnt/jay/octave-1.1.1/liboctave ex_dld.C

Which yields:

ex_dld.C:10: macro `DEFUN_DLD' used with only 6 args

This could be extremely simple - I don't know any c++ 
- so any suggestions appreciated.  However it seems to me
that DEFUN_DLD defined in defun-dld.h needs 7 arguments
(SFname is missing).  Could this be anything to do with
whether octave is configured with DLD support?
(included the source files since they're very short)
Unfortunatly, can't recompile octave to check above since 
my executables refuse to run across solaris-NFS !?

Also, will be upgrading to ELF soon.  Since dld doesn't work
with ELF, will dynamic loading still work with octave?

Regards,
jay

CC to address@hidden if possible

ps: I am very impressed by octave and am having much trouble
believing its free.  Muchas Muchas Gracias to 'jwe' and contributors.


------- ex_dld.C source follows -------

 #include <iostream.h>

 #include "defun-dld.h"
 #include "tree-const.h"

 DEFUN_DLD ("hello", Fhello, Shello, -1, -1,
  "hello (...)\n\
 \n\
 Print greeting followed by the values of all the arguments passed.\n\
 Returns all the arguments passed.")
 {
       Octave_object retval;
       cerr << "Hello, world!\n";
       int nargin = args.length ();
       for (int i = 1; i < nargin; i++)
         retval (nargin-i-1) = args(i).eval (1);
       return retval;
 }

-------------- defun-dld.h  follows ------

// defun-dld.h                                           -*- C++ -*-
/*
[GPL and jwe copyright snipped]
*/

#if !defined (octave_defun_dld_h)
#define octave_defun_dld_h 1

#if defined (octave_defun_h)
#error defun.h and defun-dld.h both included in same file!
#endif

#include "defun-int.h"

// Define a builtin function that may be loaded dynamically at run
// time.
//
// If Octave is not configured for dynamic linking of builtin
// functions, this is exactly like DEFUN.

#if defined (WITH_DLD) && defined (OCTAVE_LITE) && defined (MAKE_BUILTINS)
#define DEFUN_DLD_BUILTIN(name, fname, sname, nargin_max, nargout_max, doc) \
  BEGIN_INSTALL_BUILTIN \
    DEFINE_FUN_STRUCT (name, 0, sname, nargin_max, nargout_max, 0, doc); \
    install_builtin_function (&sname); \
  END_INSTALL_BUILTIN
#else
#define DEFUN_DLD_BUILTIN(name, fname, sname, nargin_max, nargout_max, doc) \
  DEFUN_INTERNAL (name, fname, sname, nargin_max, nargout_max, 0, doc)
#endif

// Define a function that may be loaded dynamically at run time.
//
// If Octave is not configured for dynamic linking of builtin
// functions, this won't do anything useful.
//
// The forward declaration is for the struct, the second is for the
// definition of the function.

#if ! defined (MAKE_BUILTINS)
#define DEFUN_DLD(name, fname, sname, fsname, nargin_max, nargout_max, doc) \
  DECLARE_FUN (fname); \
  DEFINE_FUN_STRUCT (name, fname, sname, nargin_max, nargout_max, 0, doc); \
  DEFINE_FUN_STRUCT_FUN (sname, fsname) \
  DECLARE_FUN (fname)
#endif

#endif

/*
;;; Local Variables: ***
;;; mode: C++ ***
;;; page-delimiter: "^/\\*" ***
;;; End: ***
*/


reply via email to

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