MathGroup Archive 2006

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

Search the Archive

Re: Re: NETLink:

  • To: mathgroup at smc.vnet.net
  • Subject: [mg71949] Re: [mg71926] Re: [mg71867] NETLink:
  • From: "Zhe Hu" <iamhuzhe at gmail.com>
  • Date: Tue, 5 Dec 2006 06:04:53 -0500 (EST)

Thanks a lot. Yes, by changing that xml file with the correct .NET version,
I can now load that assembly.

That also helped me with another possibility. Since .NET has SerialPort type
support after .NET 2.0, now I can use serial port directly from .NET/Link.

Needs["NETLink`"]
InstallNET[];
ser = NETNew["System.IO.Ports.SerialPort","COM1"]
ser@Open[]
ser@Write["abc"]

Thanks,
Hu Zhe

On 12/4/06, Todd Gayley <tgayley at wolfram.com> wrote:
>
> At 05:22 AM 12/1/2006, Zhe Hu wrote:
> >I read about driving LEGO Mindstorms RCX with .NET from
> >
> http://msdn.microsoft.com/coding4fun/hardware/robotics/article.aspx?articleid=877488
> >
> >So I downloaded the assembly: C4F.LegoRcx.dll. Try to use it in
> Mathematica
> >by .NetLink, but failed.
> >
> >Needs["NETLink`"]
> >InstallNET[]
> >LoadNETAssembly["C:\\lego\\Debug\\C4F.LegoRcx.dll"]
> >
> >here is the error message from Mathematica:
> >"""
> >NET::netexcptn: A .NET exception occurred: System.BadImageFormatException:
> \
> >The format of the file 'C4F.LegoRcx.dll' is invalid.
> >File name: "C4F.LegoRcx.dll"
> >    at System.Reflection.Assembly.nLoad(AssemblyName fileName, String \
> >codeBase, Boolean isStringized, Evidence assemblySecurity, Boolean \
> >throwOnFileNotFound, Assembly locationHint, StackCrawlMark& stackMark)
> >    at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef,
> \
> >Boolean stringized, Evidence assemblySecurity, StackCrawlMark& stackMark)
> >    at System.Reflection.Assembly.LoadFrom(String assemblyFile, Evidence
> \
> >securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm)
> >    at Wolfram.NETLink.TypeLoader.LoadAssembly(String assemblyName)
> >    at Wolfram.NETLink.Internal.CallPacketHandler.loadAssembly
> (KernelLinkImpl
> >\
> >ml)
> >
> >LoadNETAssembly::noload: The assembly C:\lego\Debug\C4F.LegoRcx.dll
> either \
> >was not found or could not be loaded.
>
>
> Hu,
>
> The problem is that C4F.LegoRcx.dll is built for the .NET Framework 2.0,
> and .NET/Link is configured to use .NET 1.1. To allow .NET/Link to use
> .NET
> 2.0, edit the file <Mathematica
> dir>/AddOns/NETLink/InstallableNET.exe.config. Add this line as the first
> <supportedRuntime> line:
>
>      <supportedRuntime version="v2.0.50727" />
>
> Now you will be able to load and use those RCX examples.
>
> Future releases of .NET/Link will by default use .NET 2.0 (or 3.0) on
> machines that have it installed.
>
> You will probably need to put the auxiliary DLLs (GhostAPI.dll,
> PbkComm32.dll, PbkUsbPort.dll) needed for those examples into a directory
> on your Windows PATH. There doesn't appear to be much documentation for
> the
> C4F.LegoRcx assembly, so use the NETTypeInfo function on assemblies,
> classes, and objects to see the types, methods, and properties available.
>
>
> Todd Gayley
> Wolfram Research
>
>


  • Prev by Date: Re: (revision) NIntegrate that upper limit is infinite
  • Next by Date: Re: Re: Problem with Minimize function
  • Previous by thread: Re: NETLink:
  • Next by thread: Re: Help finding x of hypergeometric 2F1[a,b,c,x] ?