DEV Community

Discussion on: Calling Swift from Go

Collapse
 
gerwert profile image
gerwert

I had a similar error in a different project, after upgrading MacOS (and Swift to Swift 5?). Solved it by deleting .build directory, and re-building the project.
Did you try the example project github.com/onderweg/swift-from-go ?

Collapse
 
vjerci profile image
Vjeran • Edited

I've tried your solution but for some reason it doesn't seem to work

all the time it reports error image missing or something like that

then i've stumbled upon this article

ardanlabs.com/blog/2013/08/using-c...

figured out .dylib is missing

and then added it like this:

go run -exec "env LD_LIBRARY_PATH=/Users/vjeranfistric/go/src/github.com/vjerci/swift-from-go" main.go
Enter fullscreen mode Exit fullscreen mode

or packing it into folder like this

swift-from-go.app/Contents/Frameworks/libgo_swift.dylib
Enter fullscreen mode Exit fullscreen mode

It did the trick for me