www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - executable libary pattern `Error: only one entry point `main` is

got the annoying `Error: only one entry point `main` is allowed` 
again, this time I wanted a real fix rather then leaving a 
comment out main, found this pattern:

```d
foo.d

import bar;

void main(){
	foobar(3);
}
```

```d
bar.d

void foobar(int i){
     import std;
     i.writeln;
}

version(localmain){
     void main(){
         foobar(7);
}}
```
---
```bash
% ./bar.d
7
% ./foo.d
3
```
Jul 20