[swift-build-dev] [SwiftPM] [swift-build] How to use C module in Swift REPL

bhargav gurlanka bhargav.grlnk at gmail.com
Wed May 25 14:38:16 CDT 2016


Hi,

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:
  _say_hi




Regards,
Bhargav Gurlanka
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-build-dev/attachments/20160526/ed560d47/attachment.html>


More information about the swift-build-dev mailing list