On Tuesday, 22 October 2019 at 08:30:36 UTC, Daniel Kozak wrote:
On Tue, Oct 22, 2019 at 10:25 AM Prokop Hapala via Digitalmars-d-learn <digitalmars-d-learn@puremagic.com> wrote:

...

Also where is RDMD in the equation? I really like the idea run binary programs like:

#!/usr/bin/env rdmd
import std.stdio;
void main(){
     writeln("Hello, world!");
}

But I cannot find any documentation how to use rdmd with any libraries/dependencies and dub.json ? Not even statically linked, not to say dynamic.


You can't use rdmd with dub, but for simple scripts you can use dub directly:

https://dub.pm/advanced_usage.html

Here an example, save it as example.d:

```d
#!/usr/bin/env dub

/+ dub.json:
{
    "name":"example-s3",
    "dependencies":{
        "aws-sdk:core": "1.0.0",
        "aws-sdk:s3": "1.0.0"
    }
}
+/

import aws.sdk.core, aws.sdk.s3;

void main()
{
    auto client = new AwsClient();
    auto s3 = new S3Service(client);

    ...
}
```

On linux you could start this file using command ```./example.d```.
Or with command ```dub example.d```.

Kind regards
André

Reply via email to