99![ tuxOS] ( https://img.shields.io/badge/os-tuxOS-green.svg?style=flat )
1010![ Travis] ( https://travis-ci.org/AlwaysRightInstitute/mod_swift.svg?branch=develop )
1111
12- ** mod_swift** is a technology demo which shows how to write native modules
12+ ** mod_swift** allows you to write native modules
1313for the
1414[ Apache Web Server] ( https://httpd.apache.org )
1515in the
@@ -25,6 +25,13 @@ Also included are Xcode base configurations, module maps for Apache and APR
2525as well as a few API wrappers that are used to workaround ` swiftc ` crashers
2626and Swift-C binding limitations.
2727
28+ ** Note** : mod_swift is very low level, we currently provide two efforts to
29+ make Apache module development more pleasant:
30+ the Swift [ Apache API] ( https://github.com/modswift/Apache ) ,
31+ and [ ApacheExpress] ( https://apacheexpress.io/ ) .
32+ The latter provides a very convenient Node.js/ExpressJS like API
33+ which makes it very easy to write modules.
34+
2835### How to use the module in Apache
2936
3037Before you can load a Swift Apache module, you need to load mod_swift into
@@ -81,9 +88,6 @@ regular C modules.
8188- The code is
8289 [ properly formatted] ( http://www.alwaysrightinstitute.com/swifter-space/ ) ,
8390 max width 80 chars, 2-space indent.
84- - This doesn't use ` apxs ` because that is badly b0rked on both 10.11 and 10.12.
85- - It uses a lot of hardcoded load and lookup pathes, remember, it is a demo!
86- - It has some leaks and issues, e.g. modules are not properly unloaded.
8791- Sure, you can link against arbitrary Swift dylibs,
8892 [ mustache] ( Sources/mustache/ ) is an example for exactly that.
8993- However, you currently cannot use the Swift Package Manager to create
@@ -92,19 +96,10 @@ regular C modules.
9296- Yes ` mod_swift ` itself could be avoided by including the .c in the Swift
9397 module. Yes, you can even statically link Swift including its runtime. Let
9498 me know if this is interesting, I have a branch which does exactly that.
95- - There is one big bet in the code: Officially there is no way to invoke a
96- Swift function from C, only the other way around!
97- In other words: it is pure luck that
98- [ this works] ( Sources/mod_swift/mod_swift.c#L47 ) and is ABI compatible with C.
9999- If you would want to debug the stuff in Xcode - ` /usr/sbin/httpd ` is under
100100 [ macOS SIP] ( https://support.apple.com/en-us/HT204899 ) .
101101- On macOS 10.11 starting Apache with -X crashes a few seconds after the last
102102 request was received. Maybe just SIGPIPE or sth. 10.12 looks fine.
103- - Unloading is an issue. I think the Apple and GNUstep Objective-C
104- runtimes cannot be properly unloaded (I've heard there is a great runtime
105- that can).
106- No idea what the situation with 'pure Swift' is.
107- - Would be cool if Swift 4 would get a proper ` extern C {} ` .
108103- Yes, Apache content handlers are not [ Noze.io] ( http://noze.io/ ) like
109104 asynchronous but run in a traditional, synchronous thread-setup.
110105- Apache varargs funcs are not available since Swift doesn't support such. We
@@ -130,7 +125,7 @@ for Apache 1.3.
130125
131126### Status
132127
133- This is a demo. Do not use it for realz. At least not w/o our help ;->
128+ This is not a demo anymore, it actually seems to work quite well.
134129
135130### Who
136131
0 commit comments