Compiling f# for xbox360

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-10 19:11:53

问题


I've been trying to compile some libraries I've written in f# to work in a game I'm writing for the xbox360, except I keep getting an error saying "The module/namespace 'System.Net.WebRequest' from compilation unit 'System' did not contain the namespace, module or type 'WebRequest'.

The command I've been using to compile it is

"C:\Program Files (x86)\Microsoft F#\v4.0\fsc.exe" -o:obj\Release\XBox360.dll --standalone --noframework --define:TRACE --optimize+ --tailcalls+ -r:"C:\Program Files (x86)\Microsoft XNA\XNA Game Studio\v4.0\References\Xbox360\mscorlib.dll" -r:"C:\Program Files (x86)\Microsoft XNA\XNA Game Studio\v4.0\References\Xbox360\System.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\FSharp\2.0\Runtime\v2.0\FSharp.Core.dll" --target:library --warn:3 --warnaserror:76 --fullpaths --flaterrors somefile.fs

Does anyone know of a way to fix, or avoid this problem?


回答1:


The xbox xna assemblies are a cut down version of the normal .net ones (it uses the client framework +- a few bits).

One major limitation is that with xna on the xbox you can only communicate using microsoft's LIVE servers. i.e. no web requests.

You can see this by comparing the SerializableAttribute page, which is supported (has the xna symbol next to supported members and constructors) with the WebRequest page, which does not.


All is not lost. It appears the core F# DLLS require that class to be present in System, so you can't just link to the XNA/xbox versions of the core library.
Luckely some people at microsoft kindly built DLLs without this restriction. See here:

https://docs.google.com/presentation/d/1teGhBf-m7qRkMzsbCKvRcIEo-QLwdK9w8VOEWqu1qWQ/edit#slide=id.ge02f430_0_70 Slide 29.

XNA + F# on Xbox 360 is not an officially supported combination. Lack of support for tail calls in CLR causes crashes with the standard F# core lib. Don Syme and others at Microsoft kindly provided a custom made F# core lib for the Xbox 360. Need to fiddle with the .fsproj files (can be done automatically using a script).

In that presentation I found the following links:

Project containing F# DLLs especially built for XNA (Looks like the folder FSharpCore in Source is what you're after): https://bitbucket.org/johdex/xnautils

A blog about developing for XNA in F#: http://sharp-gamedev.blogspot.co.uk/



来源:https://stackoverflow.com/questions/8256689/compiling-f-for-xbox360

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!