Hi all-

I've been playing with the octave-sockets package on 3.2.0 and kept running
into problems with the socket constants (e.g., AF_INET), which are, of
course, implemented as functions.  Basically, they weren't being loaded with
the sockets package, and load_socket_constants didn't help (nor did it throw
any errors).  Any attempt to use the constants resulted in an error saying
that the constant was undefined.  The functions (e.g., socket() ) worked
fine if the socket constants were replaced manually with their integer
values (e.g, 2 for AF_INET).

Long story short, it looks like a macro in sockets.cc is using the defunct
FS ## name convention instead of the more recent G ## name convention.
Making that change and rebuilding the package results in socket constants
that work as they should.

To wit, here's the change:

*** sockets-1.0.5/src/sockets.cc        2008-08-24 12:15:39.000000000 -0400
--- sockets-1.0.5-fixconst/src/sockets.cc        2009-07-22
16:51:29.000000000 -0400
***************
*** 202,208 ****
  // This macro must start with DEFUN_DLD so that the automatic collection
  // of function helps can take place.
  #define DEFUN_DLD_SOCKET_CONSTANT(name, help ) \
! DEFUNX_DLD ( #name, F ## name, FS ## name, args, nargout, help) \
  { return octave_value( name ); };

  // PKG_ADD: autoload ("AF_UNIX", "sockets.oct");
--- 202,208 ----
  // This macro must start with DEFUN_DLD so that the automatic collection
  // of function helps can take place.
  #define DEFUN_DLD_SOCKET_CONSTANT(name, help ) \
! DEFUNX_DLD ( #name, F ## name, G ## name, args, nargout, help) \
  { return octave_value( name ); };

  // PKG_ADD: autoload ("AF_UNIX", "sockets.oct");


There might be a better place to fix this, and I'm not sure how it will
impact the backwards compatibility of octave-sockets, but it's a starting
point.

Thanks,
Jeff
------------------------------------------------------------------------------
_______________________________________________
Octave-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/octave-dev

Reply via email to