GribApiDotNet / GribApi.NET

A powerful .NET library for reading and writing GRIB 1 and 2 files
Apache License 2.0
54 stars 29 forks source link

Running GribApi.NET under Mono #65

Closed jhskailand closed 7 years ago

jhskailand commented 7 years ago

I have been trying to get the GribApi.NET library to run on Linux under Mono (5.0.1.1).

I try to create a GribFile object with: GribFile file = new GribFile(pathName)

where pathName points to a valid, existing grib file which I have permissions to access.

This call throws the following exception: The type initializer for 'Grib.Api.GribFile' threw an exception.

Inner exception: _putenv_s

I see inside "GribEnvironment.cs" that the following call is made under method PutEnvVar: Win32._putenv_s(name, val);

I suspect this to be a Windows-only method. Is it possible to use a more generic call, or a platform dependent call (.NET / Mono) to ensure Mono compatibility?

0x1mason commented 7 years ago

@jhskailand I'd love to support OSX and Linux and I designed things in such a way that adding cross-platform support is possible. In fact, when I started the project, I hoped to do all the native parts via gcc. Unfortunately, it didn't work out and the native binaries that GribApi.NET wraps are Windows-only. You're the first person to ask about Mono/.NET Core, so I didn't think there was any demand.

It's definitely possible, but would take some work to set up the build. I don't have the time for that all by myself, but I'd be willing to work with you or someone else on implementing it.

0x1mason commented 7 years ago

Opened a new issue to gauge interest https://github.com/0x1mason/GribApi.NET/issues/73