
Hi, Has anyone used hs-dotnet (http://haskell.forkio.com/dotnet/) with Mono on Linux? Cheers, - Dan

A native-managed bridge for the clr while being cross platform is quite possible but unfortunately the developers of hs-dotnet reference ole32 and oleaut32 as extra libraries. This means that the code relies on the com/ole/activex layer in windows which is what Microsoft's implementation of the clr is built upon and their low level clr apis are written in. Mono doesn't use this and afaik there isn't a com layer for nix (unless of course you use wine but that may be overkill). The salsa project seems to have similar bindings although it does say on it's wiki page "Supporting Mono shouldn't be too much work though"

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 7/10/10 10:58 , Tim Matthews wrote:
A native-managed bridge for the clr while being cross platform is quite possible but unfortunately the developers of hs-dotnet reference ole32 and oleaut32 as extra libraries. This means that the code relies on the com/ole/activex layer in windows which is what Microsoft's implementation of
I suspect that just means that they're needed during the link phase when building on Windows; if the point is binding to the .Net CLR, I imagine Mono will have its own external dependencies in place of those. (If they were direct dependencies --- meaning that .Net bindings used them directly --- then Mono couldn't exist.) - -- brandon s. allbery [linux,solaris,freebsd,perl] allbery@kf8nh.com system administrator [openafs,heimdal,too many hats] allbery@ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.10 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkw4wJ0ACgkQIn7hlCsL25XBJQCghtDCHyuHUvVT13vTlQ9f8gHZ FKAAoJ77rPr/T7AVzw4iiP4ae5Y98W5G =z9yK -----END PGP SIGNATURE-----

(If they were direct dependencies --- meaning that .Net bindings used them directly --- then Mono couldn't exist.)
I don't know all the details but I do know that .Net is written in C++/com and mono does not have any com. Correct me if I'm wrong but I think calling native from managed is somewhat cross platform via p/invoke but the other way is achieved through either microsoft's api or through mono's api as described herehttp://www.mono-project.com/Embedding_Mono#Invoking_Methods_in_the_CIL_unive... . I said in my previous email that afaik there isn't a com for *nix but I have since found this http://linux.lsdev.sil.org/wiki/index.php/Libcom that you could try as a drop in replacement. Best of luck if you try this approach. Thanks Tim

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 7/10/10 23:58 , Tim Matthews wrote:
(If they were direct dependencies --- meaning that .Net bindings used them directly --- then Mono couldn't exist.)
I don't know all the details but I do know that .Net is written in C++/com and mono does not have any com.
And? The whole point of the .net CLR is that the implementation (Windows COM, Mono, etc.) is hidden; you work with the CLR directly, *not* the implementation behind it. (Otherwise, why bother talking to he relatively slow CLR instead of using a native toolkit?) hs-dotnet is binding to the CLR interfaces, *not* the implementation details that the CLR is designed to hide. The CLR itself, of course, needs to link to other libraries supplying its implementation details, but if that ever becomes visible at the level hs-dotnet is using then the CLR is completely useless. - -- brandon s. allbery [linux,solaris,freebsd,perl] allbery@kf8nh.com system administrator [openafs,heimdal,too many hats] allbery@ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.10 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkw5Q0AACgkQIn7hlCsL25V8xACfWNgOKatplLerJ7bioRTgHs46 Uu0AniKrSud1cKNplEjNRkq8Qx3bAzNX =3uqb -----END PGP SIGNATURE-----

On Sun, Jul 11, 2010 at 4:06 PM, Brandon S Allbery KF8NH < allbery@ece.cmu.edu> wrote:
The whole point of the .net CLR is that the implementation (Windows COM, Mono, etc.) is hidden; you work with the CLR directly, *not* the implementation behind it.
True. At least for CLR code that only deals with more CLR code.
hs-dotnet is binding to the CLR interfaces, *not* the implementation details that the CLR is designed to hide.
I trust you understand for haskell to access CLR it must make use of the FFI native layer and that when I create a new C# class no haskell modules are automatically created. The CLR itself, of course, needs to link to other libraries supplying
its implementation details,
Each implementation of the CLR is providing an API for calling into the CLR from the outside. While calling out via p/invoke is platform independent (the p/invoke api itself, there's no guarantee of a specific lib existing), calling in is implementation specific. If a new CLR implementation was written in javascript I wouldn't be too surprised if they didn't provide the same header files as mono.
but if that ever becomes visible at the level hs-dotnet is using then the CLR is completely useless.
Completely useless? The CLR was not created for interop but interop was created because some of us don't target the CLR. C#, VB.Net, F#, P#, IronPython, etc... can call each others code uniformly no matter who's implementation/platform is be used. This is what the CLR is there for, guaranteeing seem-less integration within not seem-less interop. The idea is that with modern hardware it became practical to stop writing native code and target either CLR or JVM but it was also solving previous language integration issues of the 90's. COM was messy and verbose but it kinda worked for getting OO code to work between any native language that supported COM. If there was a IronHaskell for example we too would benefit platform independent code that just worked anywhere. Most of us are using GHC however, which produces native code instead of common intermediate language but we can access CLR through either hs-dotnet or Salsa. One of 2 things must happen to use these with mono. Ideally each library would have a stage in configuration that checked whether .Net exists or Mono exists and use the appropriate headers and libs accordingly during the build stage. The other option is less than ideal but it's advantage is that it requires no changes to be applied to hs-dotnet: Provide the libcomhttp://linux.lsdev.sil.org/wiki/index.php/Libcomto all non windows machines that you intend to use hs-dotnet on.

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 7/11/10 05:48 , Tim Matthews wrote:
Completely useless? The CLR was not created for interop but interop was created because some of us don't target the CLR. C#, VB.Net, F#, P#,
No, it was created to be a safer runtime environment; but this is a form of interop between the managed environment and unmanaged APIs. - -- brandon s. allbery [linux,solaris,freebsd,perl] allbery@kf8nh.com system administrator [openafs,heimdal,too many hats] allbery@ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.10 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkw6KX8ACgkQIn7hlCsL25UqVgCfWKIyuZ2w2sPhqq7oEp6MuDLZ lj0An1AKb8O7i/Z2RdCgr/5yxoytC8p1 =nlmL -----END PGP SIGNATURE-----
participants (3)
-
Brandon S Allbery KF8NH
-
Daniel Cook
-
Tim Matthews