Vibe.d & DUB

Chris wendlec at tcd.ie
Tue Nov 19 02:41:06 PST 2013


On Monday, 18 November 2013 at 18:16:07 UTC, Sönke Ludwig wrote:
> Am 18.11.2013 17:43, schrieb Chris:
>> Based on "examples/http_server" I get the following errors 
>> when I add an
>> external source file:
>> 
>> source/app.d(26): Error: module app function
>> vibe.http.server.handleRequest is private
>> source/app.d(26): Error: function vibe.http.server.listenHTTP
>> (HTTPServerSettings settings, void delegate(HTTPServerRequest 
>> req,
>> HTTPServerResponse res) request_handler) is not callable using 
>> argument
>> types (HTTPServerSettings, bool function(Stream http_stream,
>> TCPConnection tcp_connection, HTTPServerListener listen_info, 
>> ref
>> HTTPServerSettings settings, ref bool keep_alive))
>> Error: DMD compile run failed with exit code 1
>> 
>> "sourceFiles": [
>>     "../../project/module/sourcefile.d"
>> ],
>> 
>> I also link to a library I copied to "source/lib" in the 
>> server-project
>> folder.
>> 
>> If I exclude the reference from package.config and from app.d 
>> it works
>> perfectly fine.
>> 
>> If I include the external file and exclude the line
>> "listenHTTP(settings, &handleRequest);", it compiles (but of 
>> course does
>> nothing.
>> 
>> I couldn't find anything on google nor in the documentation 
>> about
>> vibe.http.server.listenHTTP
>> 
>> Something trivial, I suppose, but I cannot find it.
>
> It seems like it picks up the private 
> vibe.http.server.handleRequest
> function instead of your own callback function. Maybe a typo or 
> a
> forgotten import? If not, you could try to use a fully 
> qualified name
> (i.e. "yourmodule.handleRequest").
>
> /OT: What happened to
> https://github.com/D-Programming-Language/dmd/pull/2256?

Thanks for your help. I could resolve the issue. In the external 
library I link to, there are modules called "app.[...]". 
Apparently this caused all the confusion. The solution was to 
turn the file "source/app.d" into "module source.app;" Now 
everything is compiled and linked correctly and the custom 
function source.app.handleRequest is called.

I was already beginning to suspect a conflict of name spaces and 
modules as I was writing this post, only on Mondays my brain is a 
bit slow ...


More information about the Digitalmars-d mailing list