Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/msakai/haskell-foreign-library-example
https://github.com/msakai/haskell-foreign-library-example
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/msakai/haskell-foreign-library-example
- Owner: msakai
- License: bsd-3-clause
- Created: 2022-07-28T15:29:43.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-07-29T11:49:37.000Z (over 2 years ago)
- Last Synced: 2024-10-13T23:49:12.165Z (3 months ago)
- Language: C
- Size: 11.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: ChangeLog.md
- License: LICENSE
Awesome Lists containing this project
README
# haskell-foreign-library-example
This is a repository for experimenting with `foreign-library` feature of GHC.
## Usage with `stack`
```
$ stack build
$ stack exec -- gcc test.c -Ilib -L$(stack path --local-install-root)/lib -lexample -o test
```macOS:
```
$ install_name_tool -add_rpath $(stack path --local-install-root)/lib test
$ ./test
```Linux:
```
$ export LD_LIBRARY_PATH=$(stack path --local-install-root)/lib:$LD_LIBRARY_PATH
$ ./test
```Windows (MINGW):
```
$ export PATH=$(cygpath -u $(stack path --local-install-root))/lib:$PATH
$ ./test
```## Usage with `cabal-install`
```
$ cabal build
$ cabal exec -- gcc test.c -Ilib -L$(dirname $(cabal list-bin example)) -lexample -o test
```macOS:
```
$ install_name_tool -add_rpath $(dirname $(cabal list-bin example)) test
$ ./test
```Linux:
```
$ export LD_LIBRARY_PATH=$(dirname $(cabal list-bin example)):$LD_LIBRARY_PATH
$ ./test
```Windows (MINGW):
```
$ export PATH=$(cygpath -u $(dirname $(cabal list-bin example))):$PATH
$ ./test
```