Vibe.d on Windows

tchaloupka chalucha at gmail.com
Mon Sep 21 13:14:22 UTC 2020


On Monday, 21 September 2020 at 08:50:59 UTC, Martyn wrote:
> Hi all. New member but been into D for a little while.
>
> Bit of a backstory - I look after software for a particular 
> company. Their systems are old and (still) using things like 
> VB6 and Classic ASP. Yes they are Windows Servers. I have 
> managed to update some of their software to .NET when the 
> opportunity presents itself.
>
> With regards to their web tools - I want to re-write their 
> classic ASP to something else. Now I could use .NET Core or 
> similar.. but I would also be interested in moving their tools 
> over to the D language.
>
> I am primarily a Linux user and have played about with Vibe.d 
> and really like it. However, has anyone experienced using 
> vibe.d for Windows and IIS? Is the process much harder?
>
> Also, they use SQL Server. I have used D libraries for MySQL 
> which are fine - but what is the status regarding D 
> communicating with SQL Server?
>
> I am just wondering if it is worth it - or whether I should 
> just stay with C# .NET Core? I know C# is getting better 
> installed and used in the Linux world but I just feel D is the 
> better language as I could even encourage the company to move 
> to Linux systems and save some pennies.
>
> How do you guys find using D in the Windows environment (real 
> projects and releases) as well as IIS and SQL Server? What 
> about build a D program to be a Windows Service??
>
> Thanks.

In short - as much as I like D, I'd avoid using it in this 
scenario if you want to make fast progress and don't want to 
spent a lot of time on it.

1) Creating a windows service - shouldn't be a problem. There's 
https://code.dlang.org/packages/daemonize (never tried it, but 
should get you started)

2) Hosting vibe-d application in IIS - probably only by means of 
reverse proxy - see ie 
https://stackify.com/how-to-deploy-asp-net-core-to-iis/ as .Net 
Core is hosted the same way there

3) MS SQL - real problems starts here..

I don't know of any D project to provide MS SQL connectivity for 
vibe-d.

If I'm not mistaken D provides only basic ODBC bindings here: 
https://dlang.org/phobos/etc_c_odbc_sql.html
So you would need to work with ODBC drivers with it.

This could be a good starting point: 
https://github.com/adamdruppe/arsd/blob/master/mssql.d

But there'll probably be a problem with async access needed for 
vibe (or you'd block fibers).
See https://code.dlang.org/packages/vibe-d-postgresql for a 
project that works with vibe by using async methods of underlying 
libpq and socket events handled by vibe-d - you'll need something 
like that too (and I don't know if ODBC driver can support 
something like that - seems it should be possible: 
https://stackoverflow.com/questions/305795/can-i-make-asynchronous-odbc-calls-any-reference-materials).

As this is all pretty lowlevel stuff, you'll end up writing some 
abstraction layer above.

Other option (probably better but even more time consuming) would 
be to implement MS SQL communication protocol natively for vibe-d 
(similarly to mysql-native).

See 
https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-tds/b46a581a-39de-4745-b076-ec4dbb7d13ec

Rust has it this way too: https://docs.rs/tiberius/0.4.9/tiberius/

So it's all doable, but there isn't existing solution you could 
use right away and profit.


More information about the Digitalmars-d mailing list