MathGroup Archive 2008

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

Search the Archive

Re: .NET/Link: Explicitly define data type to be sent to .NET object?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg85729] Re: .NET/Link: Explicitly define data type to be sent to .NET object?
  • From: David Bailey <dave at Remove_Thisdbailey.co.uk>
  • Date: Wed, 20 Feb 2008 06:58:51 -0500 (EST)
  • References: <fpdusr$rah$1@smc.vnet.net>

heiko wrote:
> Hello,
> 
>     To get some data from Mathematica to a .NET object, I need to
> avoid confusion between different integer or real data types in
> Mathematica and C++. Is it somehow possible to explicitly define the
> type of a variable being sent from Mathematica to C++?
> 
>     Some more detailed description of the problem: The .NET object
> contains several overloaded methods for different data types, e.g.
> void insert(SByte value), void insert(Int16 value), void insert(Int32
> value), void insert(Int64 value), etc. When I now send integer data
> from Mathematica to the object using object at insert[...] the data is
> apparently always sent to the insert(Int64 value) method; even if the
> integer in Mathematica only contains a value from 0 to 255. This is,
> however, not the method I need to call, but e.g. void insert(SByte
> value). As I haven't written the .NET library myself, I cannot just
> change the names of the methods inside.
> 
>     How can I tell .NET/Link in Mathematica that I want the integer/
> real data in Mathematica to be transferred to a specific integer or
> real data type in C++?
> 
>     Thanks a lot in advance for any help!
> 
> Best regards,
> Heiko
> 
Why not sidestep the problem by writing some wrapper functions in C#. 
The function could take an int as input, and shorten it and call 
whatever function (sorry, method!) you require.

David Bailey
http://www.dbaileyconsultancy.co.uk


  • Prev by Date: Re: Sterographic display
  • Next by Date: Re: A Use for Interpretation
  • Previous by thread: .NET/Link: Explicitly define data type to be sent to .NET object?
  • Next by thread: Re: .NET/Link: Explicitly define data type to be sent to .NET object?