{"action":"created","issue":{"url":"https://api.github.com/repos/darrenkopp/libsass-net/issues/34","labels_url":"https://api.github.com/repos/darrenkopp/libsass-net/issues/34/labels{/name}","comments_url":"https://api.github.com/repos/darrenkopp/libsass-net/issues/34/comments","events_url":"https://api.github.com/repos/darrenkopp/libsass-net/issues/34/events","html_url":"https://github.com/darrenkopp/libsass-net/issues/34","id":103691360,"number":34,"title":"Some thoughts on the future Native binding","user":{"login":"am11","id":3840695,"avatar_url":"https://avatars.githubusercontent.com/u/3840695?v=3","gravatar_id":"","url":"https://api.github.com/users/am11","html_url":"https://github.com/am11","followers_url":"https://api.github.com/users/am11/followers","following_url":"https://api.github.com/users/am11/following{/other_user}","gists_url":"https://api.github.com/users/am11/gists{/gist_id}","starred_url":"https://api.github.com/users/am11/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/am11/subscriptions","organizations_url":"https://api.github.com/users/am11/orgs","repos_url":"https://api.github.com/users/am11/repos","events_url":"https://api.github.com/users/am11/events{/privacy}","received_events_url":"https://api.github.com/users/am11/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/darrenkopp/libsass-net/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-08-28T10:14:21Z","updated_at":"2016-01-17T21:01:11Z","closed_at":null,"body":"In the forthcoming release of libsass ([v3.3.0](https://github.com/sass/libsass/issues/1453)), the structure of `.vcxproj` file that resides in the upstream has changed: https://github.com/sass/libsass/pull/1439. It now produces a `.dll` and `.lib` (it used to produce `sassc.exe`, which is now refactored to sassc repo where `.exe` belongs: https://github.com/sass/sassc/pull/132).\r\n\r\nWhat this mean for libsass-net is there are (at least) two approaches that can be taken for enhancement:\r\n\r\n1. Restructure the [libsass-net/libsass/LibSass.vcxproj](https://github.com/darrenkopp/libsass-net/blob/8088270c9/libsass/LibSass.vcxproj) by removing all the `native/*` compile targets in favour of [`<import>` `native/win/libsass.targets`](https://github.com/sass/sassc/blob/master/win/sassc.vcxproj#L165).\r\n  * I have not figure out yet how to specify `CompileAsManaged=false` for entire group of sources, imported by `.targets` in git submodule scenario (i.e. without modifying .targets itself).\r\n  * Benefit: separation of concern - libsass-net will not have to update binding layer for each release of libsass unless there are interface/API breaking changes, which seldom happen.\r\n2. Use [shim approach taken by dotnet/corefx team](https://github.com/dotnet/corefx/blob/eacdd5d4a8bc6d1373f1cc24bdf718c386ef8831/Documentation/coding-guidelines/interop-guidelines.md) and ditch C++/CLI binding all together and use `DllImport[]` directive in C#, to import the upstream functions and properties to be consumed. This means the `native/win/libsass.vcxproj` will be build as part of the build step (`<Exec>`'ing out the MSBuild task directly in `.csproj` file) or added to libsass-net solution directly and then `DllImport`'d in C# code without intermediate binding `LibSass.vcxproj`.\r\n  * Benefits: in addition to the aforementioned benefits, libsass-net will be able to target Unix platforms via Mono (libsass.so is already distributed and build on many Unices). This may also provide significant performance boost (https://github.com/darrenkopp/libsass-net/issues/25).\r\n\r\nNote (for option 2): (as mentioned in the [`Goals` section](https://github.com/dotnet/corefx/blob/eacdd5d4a8bc6d1373f1cc24bdf718c386ef8831/Documentation/coding-guidelines/interop-guidelines.md#goals)) with shim approach the inherent benefit is; the ABI varies for each platform (libc for example), but the API will remain consistent for most part. This is aligned with what @mgreter and @QuLogic envisioned for libsass' new C API: https://github.com/sass/libsass/issues/631.\r\n"},"comment":{"url":"https://api.github.com/repos/darrenkopp/libsass-net/issues/comments/172381099","html_url":"https://github.com/darrenkopp/libsass-net/issues/34#issuecomment-172381099","issue_url":"https://api.github.com/repos/darrenkopp/libsass-net/issues/34","id":172381099,"user":{"login":"aviatrix","id":151474,"avatar_url":"https://avatars.githubusercontent.com/u/151474?v=3","gravatar_id":"","url":"https://api.github.com/users/aviatrix","html_url":"https://github.com/aviatrix","followers_url":"https://api.github.com/users/aviatrix/followers","following_url":"https://api.github.com/users/aviatrix/following{/other_user}","gists_url":"https://api.github.com/users/aviatrix/gists{/gist_id}","starred_url":"https://api.github.com/users/aviatrix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aviatrix/subscriptions","organizations_url":"https://api.github.com/users/aviatrix/orgs","repos_url":"https://api.github.com/users/aviatrix/repos","events_url":"https://api.github.com/users/aviatrix/events{/privacy}","received_events_url":"https://api.github.com/users/aviatrix/received_events","type":"User","site_admin":false},"created_at":"2016-01-17T21:01:11Z","updated_at":"2016-01-17T21:01:11Z","body":"awesome work @am11 , keep us posted and let us know if we can help with something :)"}}