octave-maintainers
[Top][All Lists]
Advanced

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

Re: Compiling octave with MSVC


From: Michael Goffioul
Subject: Re: Compiling octave with MSVC
Date: Wed, 11 Oct 2006 08:24:20 +0200
User-agent: Thunderbird 1.5.0.7 (Windows/20060909)

John W. Eaton a écrit :
On 10-Oct-2006, Michael Goffioul wrote:

| The problem is more about auconf, which (I guess) cannot cope with MSVC | (object suffix,
| compiler flags...).

What about using something like cccl (http://cccl.sourceforge.net) as
a wrapper script to translate gcc-like compiler flags to MSVC options?
This might indeed makes things easier. I'll have a look (I didn't know about it).
| For instance, in mx-op-defs.h, I had to rewrite the NDS_CMP_OP macros as | the following:
| #define NDS_CMP_OP2(F, OP, ND, NDC, S, SC, SPEC1, SPEC2) \
|   boolNDArray \
|   F (const ND& m, const S& s) \
|   { \
|     boolNDArray r; \
|  \
|     int len = m.length (); \
|  \
|     r.resize (m.dims ()); \
|  \
|     for (int i = 0; i < len; i++) \
|       r.elem(i) = operator OP <SPEC1,SPEC2> (NDC (m.elem(i)), SC (s)); \
|  \
|     return r; \
|   }

OK, what are SPEC1 and SPEC2 defined to be?  The types of the
operands?  Although it seems much more natural to write
SPEC1 and SPEC2 are the internal type of the octave_int<> template. For instance I use it
in mx-i8nda-ui8.cc as:
NDS_CMP_OPS(int8NDArray,  , octave_uint8, , int8_t, uint8_t)
  x OP y

instead of
  operator OP <T1, T1> (x, y)

it is not horrible, especially since it is buried in a macro.  Please
go ahead and submit the patches for this change separately from the
rest of the changes.
Changes are not straightforward as mx-*.cc files are generated by mk-ops.awk from mx-ops. So this means changing these 2 files and not the mx-*.cc files. Moreover, only a few of the mx-*.cc files need to be changed: only those for which the second operand is an unsigned scalar. The other compile fine. Currently, I have a little patch that I apply after running mk-ops.awk, which touches
only the needed files.
| One possible solution is to prefix exported functions with EXTERN macro | that you can define | to "extern" under UNIX and "__declspec(dllexport/dllimport)" under | Win32. For classes, it's | a little bit tricky as the modifier must be located after the "class" | keyword, and you can't put
| "extern" there.

Please post an example of one (or two) header file(s) that you have
modified so I can see precisely what it is that you need to do for
MSVC.  It would be helpful if the code you post has examples for both
functions and classes that need to be exported.
For instance in lo-specfun.h:
   extern OCTAVE_API double betainc (double x, double a, double b);
in oct-inttypes.h:
   #define OCTAVE_SU_TYPE1_CMP_OP_DECL(OP, LTZ_VAL, ST, UT) \
bool OCTAVE_API operator OP (const octave_int<ST>& lhs, const octave_int<UT>& rhs);
in oct-alloc.h:
class
OCTAVE_API
octave_allocator
{
...

Many things need to be exported from liboctave/ because they are use in src/. And many things (but fewer than liboctave/) need to be exported from src/ because they are used in oct files.

Michael.




reply via email to

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