# Macro `kurogane::sandbox_entry`

```rust
macro_rules! sandbox_entry {
    ($entry:path) => { ... };
}
```

Declares the entry points CEF's sandbox bootstrap calls.

Chromium's Windows sandbox is brokered by CEF's bootstrap executable, which
loads the application as a DLL and calls `RunWinMain` (windowed) or
`RunConsoleMain` (console). This macro writes both, handing the broker
state to the runtime before running `entry`.

Off Windows it expands to nothing but a signature check. The same source
builds everywhere.

## Layout

The exports have to come from the application's own crate. A `cdylib`
does not re-export symbols from its dependencies. The application lives in
`src/lib.rs` and `src/main.rs` is a shim. This layout keeps `cargo run` and
unsandboxed builds working unchanged:

```toml
[lib]
name = "myapp_lib"
crate-type = ["cdylib", "rlib"]

[[bin]]
name = "myapp"
```

The library is named apart from the binary because on Windows the two
would otherwise write the same `.pdb`, which Cargo warns about. The
bootstrap keeps the binary's name.

```rust
// src/lib.rs
pub fn run() {
    kurogane::App::new("content")
        .sandbox_mode(kurogane::SandboxMode::Chromium)
        .run_or_exit();
}

kurogane::sandbox_entry!(run);
```

```rust
// src/main.rs
fn main() {
    myapp_lib::run()
}
```

Then set `sandbox = true` under `[app]` in `kurogane.toml`. `kurogane run`
and `kurogane dev` then start the application through the bootstrap.
`kurogane bundle` ships the bootstrap under the application's name.

Invoke the macro once, at the crate root. A second invocation is a
duplicate symbol.

Source: https://github.com/0x48piraj/kurogane/blob/584c586118ee53cc04604007ee038557bd859092/kurogane/src/sandbox/entry.rs#L63
