• To: mathgroup at smc.vnet.net
• From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
• Date: Wed, 1 Aug 2001 02:19:11 -0400 (EDT)
• Organization: Universitaet Leipzig
• References: <9joa43\$18o\$1@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```Hi,

from the Online-manual :

MLGetFunction() allocates memory for the character string corresponding
to the name of the head of the function. You must call MLDisownSymbol()
to disown this memory.
-----------------------------------------------------

General it would be better to transform the mixed type to
complex only numbers with

toSend=Flatten[
yourArgument /.
{Complex[a_,b_]:> {a,b},a_Real:> {a,0.},a_Integer:> {N[a],0.}}
]

send a list of the double length. This should be faster
than to transfer/check every entry.

Regards
Jens

Sseziwa Mukasa wrote:
>
> How does one read an array in Mathlink whose entries are either real or
> complex?
>
> I am trying the following seqeunce
>
> int r,c,i,j,args;
> char *sym;
> double val;
>
> for (i=0; i<r; i++) {
>     for (j=0,j<c,j++) {
>         switch (args) {
>             case 1 :
>                 break;
>             case 2 :
>                 MLGetReal( stdlink, &val); /* Get real part*/
>                 MLGetReal( stdlink, &val); /* Get imaginary part*/
>                 break;
>         }
>     }
> }
>
> The connection dies for some reason.  I have no idea why,

```

• Prev by Date: Re: Lost Line Directives in 3D Graphics
• Next by Date: Re: Solving linear equations with symbolic RHS
• Previous by thread: RE: Lost Line Directives in 3D Graphics
• Next by thread: Re: Solving linear equations with symbolic RHS