MathGroup Archive 1998

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Re: mathlink & MS Visual C++ 6.0

  • To: mathgroup at smc.vnet.net
  • Subject: [mg15030] Re: [mg15009] Re: mathlink & MS Visual C++ 6.0
  • From: MJE <evans_nospam at gte.net>
  • Date: Wed, 9 Dec 1998 04:12:17 -0500
  • Organization: None
  • References: <73d383$i9g@smc.vnet.net> <199812050630.BAA04492@smc.vnet.net.>
  • Sender: owner-wri-mathgroup at wolfram.com

Apropos of that --

I've had problems going way back to version 2 with MathLink not working
under C++; and that was on Macintosh.  I ended up having to wrap all
the MathLink code in "extern 'C'".  That was a long time ago.  Now I
learn that things are still this way.

MathLink is hard enough to master without the hassles of C vs. C++
interfacing.  What this problem means is that all the books on C++
algorithms are useless with MathLink.  (You have to create a plain-C
buffer between MathLink and the algorithms if you want to use them.) 
It also means that nice, clean, object-based string-handling functions
cannot be used to deal with the string expression requirements of
MathLink.

It's ironic that WRI is selling MathCode C++ without having fixed this
problem with MathLink itself.  Maybe they could get the people who
built MathCode C++ to work on fixing MathLink as well.


Mark
remove "_nospam" to reply



Kevin Leuthold wrote:
> 
> I had a private email conversation with John regarding the problem he
> described, and want to share with the whole group my answer to him
> since it may be of interest to anyone else compiling MathLink programs
> with Visual C++.
> 
> John was giving mprep-generated code a .cpp extension, rather than a .c
> extension.  In other words, instead of
> 
> mprep addtwo.tm -o addtwotm.c
> 
> he was typing
> 
> mprep addtwo.tm -o addtwotm.cpp
> 
> Unfortunately, mprep generates code that fails to compile under the
> stronger  type checking that Visual C++ performs on .cpp files.  This
> probably should be considered a bug in mprep.
> 
> Fortunately, there is a simple workaround, which is to always give
> mprep-generated  code a .c extension rather than .cpp.  Of course, this
> would mean that any C++ code  in a .tm file would have to be taken out
> and put in a .cpp file.
> 
> Other than this bug that John has pointed out, there are no known
> problems with building MathLink programs using Microsoft Visual C++
> 6.0.
> 
> Kevin Leuthold
> MathLink Group
> Wolfram Research
> 
> John Gore <gore_john at bah.com> writes:
> 
> >I just moved to Vis C++ 6.0 from 4.0 and cant get my mathlink programs
> >to compile.
> 
> > I have problems with the MLInitializeIcon routine produced by mprep. I
> >get errors from  a lack of casting on structs HINSTANCE and HBRUSH
> 
> >This happens even in the addtwo example.
> 
> >Anyone using MS Vis C++ 6.0 ?
> 
> >Im using Mathematica 3.01
> >Current version of Mathlink as Downloaded Windows 95
> 
> >Thanks - JG



  • Prev by Date: Re: nice Gotcha!
  • Next by Date: Re: nice Gotcha!
  • Previous by thread: Re: mathlink & MS Visual C++ 6.0
  • Next by thread: Re: mathlink & MS Visual C++ 6.0