You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When embedding Glojure, you can also expose your own Go packages or additional standard library packages using the package map approach described in the [Accessing additional Go packages](#accessing-additional-go-packages) section below. This allows embedded Clojure code to access any Go packages you choose to expose:
168
+
169
+
```go
170
+
import (
171
+
_ "github.com/glojurelang/glojure/pkg/glj"
172
+
_ "your.app/gljimports"// Your generated package map
173
+
)
174
+
175
+
// Now Clojure code can access your exposed packages
176
+
runtime.ReadEval(`
177
+
(your$package.YourFunction "arg")
178
+
(another$package.Method)
179
+
`)
78
180
```
79
181
182
+
### When to Use Each Approach
183
+
184
+
**Use `glj` command for:**
185
+
- Writing standalone Clojure programs
186
+
- Interactive development with the REPL
187
+
- Running Clojure scripts
188
+
- Learning Clojure with Go interop
189
+
190
+
**Embed Glojure for:**
191
+
- Adding scripting to an existing Go application
192
+
- Building a platform that users extend with Clojure
193
+
- Custom control over the Glojure execution environment
194
+
- Mixing Go and Clojure in a single binary
195
+
80
196
### Interop
81
197
82
198
Glojure ships with interop with many standard library packages
0 commit comments