[swift-build-dev] [SwiftPM] [swift-build] How to use C module in Swift REPL
daniel_dunbar at apple.com
Wed May 25 14:43:04 CDT 2016
Unfortunately, the error reporting isn't very good when LLVM tries to load a library (inside the JIT) and fails.
This is probably worth reporting as a bug. I'm not sure offhand and actually investigating this currently requires digging in to what is actually happening under the covers between the Swift importer and the LLVM JIT.
> On May 25, 2016, at 12:38 PM, bhargav gurlanka via swift-build-dev <swift-build-dev at swift.org> wrote:
> I have a swift package with following layout:
> ├── Package.swift
> ├── Sources
> │ ├── BarCModule
> │ │ ├── Bar.c
> │ │ └── include
> │ │ └── Bar.h
> │ └── MyApp
> │ └── main.swift
> └── Tests
> After running swift build, I can see libBarCModule.so under .build/debug. How can I use this library in REPL?
> I've tried:
> $ swift -I.build/debug -L.build/debug -lBarCModule
> $ LD_LIBRARY_PATH=.build/debug swift -I.build/debug -L.build/debug -lBarCModule
> But in both cases, I couldn't call a function defined inside my C Module.
> 1> import BarCModule
> 2> say_hi
> error: Couldn't lookup symbols:
> Bhargav Gurlanka
> swift-build-dev mailing list
> swift-build-dev at swift.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-build-dev