On Wednesday, 18 October 2017 at 08:15:53 UTC, evilrat wrote:
[...]

This isn't the actual code but should give you a hint, the rest is up to you.

Woh Thanks a ton. I can have some working code after a few hours :D

https://github.com/icy/dusybox/blob/master/lib/dusybox/bash_builtin_hello/package.d

(A screenshot: https://github.com/icy/dusybox#a-bash-builtin-command)

I got problem with type conversion. I had to use inline declaration for `long_doc`:

```
extern(C) static builtin dz_hello_struct =
{
  name: cast (char*) "dz_hello",
  func: &dz_hello_builtin,
  flags: BUILTIN_ENABLED,
  long_doc: [
    "Hello, it's from Dlang.",
    "",
    "A Hello builtin command written in Dlang."
  ],
  short_doc: cast (char*) "dz_hello",
  handle: null
};
```

otherwise the compiler reports that some variable is not be read at compile time, or kind of `cannot use non-constant CTFE pointer in an initializer`.

There are many things I need to study from your post. So far it's good :)

Thanks again

Reply via email to