Skip to content

Commit

Permalink
Merge pull request #229 from anarchydespot/link_prefix_changes
Browse files Browse the repository at this point in the history
Changed the 'link_prefix' section to be in line with the 'link_name' section
  • Loading branch information
Kelimion authored Aug 9, 2024
2 parents 4a0a604 + 6249052 commit 2acb549
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion content/docs/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -3568,12 +3568,17 @@ foo :: proc "c" () -> int {

#### `@(link_prefix=<string>)`

This attribute can be attached to a `foreign` block to specify a prefix to all names. So if functions are prefixed with `ltb_` in the library is you can attach this and not specify that on the procedure on the Odin side. Example:
This attribute can be attached to variable and procedure declarations, either when exporting or inside a `foreign` block. So if functions are prefixed with `ltb_` in the library, you can attach this and not specify that on the procedure on the Odin side; conversely, non-Odin procedures must match the exported procedure's name with its link prefix. Example:
```odin
@(link_prefix = "ltb_")
foreign foo {
testbar :: proc(baz: int) --- // This now refers to ltb_testbar
}
@(export, link_prefix="ltb_")
foo :: proc "c" () -> int {
return 42
}
```

#### `@export` or `@(export=true/false)`
Expand Down

0 comments on commit 2acb549

Please sign in to comment.