MathLink String type
- To: mathgroup at smc.vnet.net
- Subject: [mg19993] MathLink String type
- From: fischerc at itam.cas.cz
- Date: Thu, 23 Sep 1999 23:26:34 -0400
- Organization: Deja.com - Share what you know. Learn what you don't.
- Sender: owner-wri-mathgroup at wolfram.com
I am not able to compile simple MathLink function (Mathematica v. 4, Linux),
which use a string as an argument. Like this:
:Begin:
:Function: StringLength
:Pattern: StringLength[s_String]
:Arguments: { s}
:ArgumentTypes: { String }
:ReturnType: Integer
:End:
:Evaluate: StringLength::usage = "StringLength[s_String] gives the
length of s."
#include "mathlink.h"
int StringLength( char * s)
{ int i=0; char *t = s;
while(*(t++)) i++;
return i; }
int main(argc, argv)int argc; char* argv[];
{ return MLMain(argc, argv); }
The compiling stage aborts with
StringLength.tm.c:37: conflicting types for `StringLength'
StringLength.tm:14: previous declaration of `StringLength'
The mcc compiler replaces the char * s argument specification by
int StringLength P(( kcharp_ct _tp1));
Such declaration I do not understand well.
Thank for the advice
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.