November 30, 2017
I get: core.sync.exception.SyncError@(0): Unable to lock mutex.
when calling listenHTTP via a library. It works when compiling
everything in a single application without using intermediate library.

details:

using: dmd:2.077

dub build

dmd -ofmain -L-Ldir -L-ltest1 -Isource import/main.d

./main
Listening for requests on http://[::1]:8080/
Listening for requests on http://127.0.0.1:8080/
Please open http://127.0.0.1:8080/ in your browser.
core.sync.exception.SyncError@(0): Unable to lock mutex.


source/app.d:
```
void fun(){
import vibe.vibe;
auto settings = new HTTPServerSettings;
settings.port = 8080;
settings.bindAddresses = ["::1", "127.0.0.1"];
static void hello(HTTPServerRequest req, HTTPServerResponse res){
  res.writeBody("Hello, World!");
}
listenHTTP(settings, &hello);
logInfo("Please open http://127.0.0.1:8080/ in your browser.");
runApplication();
}
```

dub.json:
```
{
"name": "test1",
  "targetType": "staticLibrary", // same with dynamicLibrary
  "targetName": "test1",

"dependencies": {
"vibe-d": "==0.7.31",  // same with 0.8.1
},
"description": "...",
"copyright": "...",
"authors": ["..."],
"license": "proprietary"
}
```

main.d:
```
import app;
void main(){
  fun;
}
```
December 01, 2017
On 2017-12-01 01:46, Timothee Cour wrote:
> I get: core.sync.exception.SyncError@(0): Unable to lock mutex.
> when calling listenHTTP via a library. It works when compiling
> everything in a single application without using intermediate library.
> 
> details:
> 
> using: dmd:2.077
> 
> dub build
> 
> dmd -ofmain -L-Ldir -L-ltest1 -Isource import/main.d

Your example doesn't link since it doesn't link with vibe.d.

-- 
/Jacob Carlborg