Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vitalyisaev2/cgo_multiversion_go_lib
Go application compiled with multiple versions of C shared library
https://github.com/vitalyisaev2/cgo_multiversion_go_lib
Last synced: about 1 month ago
JSON representation
Go application compiled with multiple versions of C shared library
- Host: GitHub
- URL: https://github.com/vitalyisaev2/cgo_multiversion_go_lib
- Owner: vitalyisaev2
- Created: 2019-10-08T11:17:28.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-10-08T12:15:31.000Z (over 5 years ago)
- Last Synced: 2024-06-19T15:04:22.922Z (7 months ago)
- Language: CMake
- Homepage:
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Build C libraries first (`gcc` and `cmake` are required):
```
./build.sh
...
-- Installing: /usr/local/lib/libcgomultiversion.so.1.0.0
-- Installing: /usr/local/lib/libcgomultiversion.so.1
-- Installing: /usr/local/lib/libcgomultiversion.so
-- Installing: /usr/local/include/cgomultiversion_v1/lib.h
...
-- Installing: /usr/local/lib/libcgomultiversion.so.2.0.0
-- Installing: /usr/local/lib/libcgomultiversion.so.2
-- Installing: /usr/local/lib/libcgomultiversion.so
-- Installing: /usr/local/include/cgomultiversion_v2/lib.h
```Try to run tests, and you'll see the error:
```
go test -count=1 -v
# github.com/vitalyisaev2/cgo_multiversion_go_lib.test
/usr/local/go/pkg/tool/linux_amd64/link: running gcc failed: exit status 1
/usr/bin/ld: /tmp/go-link-218143790/000005.o: in function `add':
/home/isaev/go/src/github.com/vitalyisaev2/cgo_multiversion_go_lib/v2/lib.c:6: multiple definition of `add'; /tmp/go-link-218143790/000002.o:/home/isaev/go/src/github.com/vitalyisaev2/cgo_multiversion_go_lib/v1/lib.c:5: first defined here
collect2: error: ld returned 1 exit status```
This code cannot be compiled with two different versions of C library because of name overlapping.