[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Using DFUNX_DLD macro
From: |
Hall, Benjamin |
Subject: |
Using DFUNX_DLD macro |
Date: |
Fri, 2 Mar 2007 11:21:48 -0500 |
I'm trying to use the octave_sockets code that was posted here
http://www.cae.wisc.edu/pipermail/octave-sources/2006-May/000001.html
in a relatively recent CVS version of octave. The original used the
DEFCONSTX macro to define built-in constants. As these are no longer
supported, I am trying to replace those with built-in functions (similar to
F_GETFD in syscalls.cc), but I'm having trouble.
For example, if I compile the code (at end of message), then, in octave
autoload("AF_INET","try2.oct")
autoload("MY_CONSTANT","try2.oct")
I am able to access MY_CONSTANT, but not AF_INET. Can someone help me with
some insight as to what I should be doing?
Thanks
Ben
try2.cpp:
==================================
// Octave Includes
#include <octave/oct.h>
#include <netdb.h>
// FROM syscalls.cc
static octave_value
const_value (const char *nm, const octave_value_list& args, int val)
{
octave_value retval;
int nargin = args.length ();
if (nargin == 0)
retval = val;
else
print_usage ();
return retval;
}
// What is the "fsname" in DEFUNX_DLD ?
#if defined (AF_INET)
DEFUNX_DLD ("AF_INET",FAF_INET,FsAF_INET,args,nargout,
"-*- texinfo -*-\n\
@deftypefn {Built-in Function} {} AF_INET ()\n\
Return the value of AF_INET socket domain constant.\n\
@seealso{AF_LOCAL}\n\
@end deftypefn")
{
return const_value ("AF_INET", args, AF_INET);
}
#endif
DEFUN_DLD (MY_CONSTANT,args,,"My constant has the value 4")
{
return const_value ("MY_CONSTANT", args, 4);
}
- Using DFUNX_DLD macro,
Hall, Benjamin <=