octave-maintainers
[Top][All Lists]
Advanced

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

MSVC compiler support [patch 17]: octinterp.dll exported symbols


From: John W. Eaton
Subject: MSVC compiler support [patch 17]: octinterp.dll exported symbols
Date: Thu, 26 Oct 2006 22:15:44 -0400

On 17-Oct-2006, Michael Goffioul wrote:

| Defines symbols exported by octinterp DLL

I applied most of this patch.  Instead of adding

  #ifdef _MSC_VER
  #define EXPORT __declspec(dllexport)
  #else
  #define EXPORT
  #endif

to defun-int.h and changing

  #define DECLARE_FUNX(name, args_name, nargout_name) \
    EXPORT octave_value_list \

  #define DEFINE_FUNX_INSTALLER_FUN3(name, fname, fsname, doc, cxx_abi) \
    extern "C" \
    bool \
    fsname ## _ ## cxx_abi (const octave_shlib& shl) \

to

  #define DECLARE_FUNX(name, args_name, nargout_name) \
    EXPORT octave_value_list \

  #define DEFINE_FUNX_INSTALLER_FUN3(name, fname, fsname, doc, cxx_abi) \
    extern "C" \
    EXPORT \
    bool \
    fsname ## _ ## cxx_abi (const octave_shlib& shl) \

Is it OK to do the use OCTAVE_EXPORT, and define that appropriately in
config.h?  Currently, OCTAVE_EXPORT is defined to be empty unless
_MSC_VER is defined, but that might change in the future.

Also, I did not apply these sections of the patch:

Index: src/toplev.cc
===================================================================
RCS file: /cvs/octave/src/toplev.cc,v
retrieving revision 1.187
diff -p -c -r1.187 toplev.cc
*** src/toplev.cc       9 Oct 2006 19:49:04 -0000       1.187
--- src/toplev.cc       17 Oct 2006 11:07:43 -0000
*************** Software Foundation, Inc., 51 Franklin S
*** 77,82 ****
--- 77,86 ----
  #include "variables.h"
  #include <version.h>
  
+ #ifdef _MSC_VER
+ #include "gripes.h"
+ #endif
+ 
  // TRUE means we are exiting via the builtin exit or quit functions.
  static bool quitting_gracefully = false;
  

This seems to be needed because HAVE_ATEXIT is not defined.  Is atexit
really not available, or is there some problem with it?  If there was
a problem, I'd like to try to find a solution because we need to have
some kind of atexit functionality.

Index: src/mex.h
===================================================================
RCS file: /cvs/octave/src/mex.h,v
retrieving revision 1.4
diff -p -c -r1.4 mex.h
*** src/mex.h   11 Oct 2006 19:23:04 -0000      1.4
--- src/mex.h   17 Oct 2006 11:07:42 -0000
*************** void mexFunction (int nlhs, mxArray* plh
*** 75,80 ****
--- 75,86 ----
  void mexFunction (int nlhs, mxArray* plhs[], int nrhs, const mxArray *prhs[]);
  #endif
    
+ #ifdef _MSC_VER
+ #ifndef OCTINTERP_API
+ #define OCTINTERP_API __declspec(dllimport)
+ #endif
+ #endif
+   
  #include "mexproto.h"
  
  /* V4 floating point routines renamed in V5.  */

I'm not sure I understand why this is defined here instead of in
mexproto.h since no symbols in mex.h are tagged with OCTINTERP_API,
but many symbols in mexproto.h are.  It would be better to have this
declared in config.h or some other header that is included in
mexproto.h.  Perhaps we need to have a header template like this

  #define OCTAVE_EXPORT @OCTAVE_EXPORT@
  #define OCTAVE_IMPORT @OCTAVE_IMPORT@

  /* API macro for libcruft */
  #ifdef CRUFT_DLL
  #define CRUFT_API OCTAVE_EXPORT
  #else
  #define CRUFT_API OCTAVE_IMPORT
  #endif
  /* API macro for liboctave */
  #ifdef OCTAVE_DLL
  #define OCTAVE_API OCTAVE_EXPORT
  #else
  #define OCTAVE_API OCTAVE_IMPORT
  #endif
  /* API macro for src */
  #ifdef OCTINTERP_DLL
  #define OCTINTERP_API OCTAVE_EXPORT
  #else
  #define OCTINTERP_API OCTAVE_IMPORT
  #endif

and do the appropriate substitutions for @OCTAVE_EXPORT@ and
@OCTAVE_IMPORT@ when configure runs.

jwe


reply via email to

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