mirror of
https://github.com/golang/go.git
synced 2025-05-05 15:43:04 +00:00
WindowsDLLs: fix cgo links. syntax highlighting.
parent
d3c2bd9906
commit
e7bf74d206
@ -6,7 +6,7 @@ First way: Dynamically load a dll, then call a method on it. You can call the me
|
|||||||
|
|
||||||
A sample program that calls Windows DLLs from Go:
|
A sample program that calls Windows DLLs from Go:
|
||||||
|
|
||||||
```
|
```go
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@ -96,7 +96,7 @@ func init() {
|
|||||||
|
|
||||||
Second way is via syscall.NewProc (etc.) instead of syscall.GetProcAddress. These are basically some helper methods over the syscall ones, you saw above, and are available in Windows only: http://golang.org/src/pkg/syscall/dll_windows.go
|
Second way is via syscall.NewProc (etc.) instead of syscall.GetProcAddress. These are basically some helper methods over the syscall ones, you saw above, and are available in Windows only: http://golang.org/src/pkg/syscall/dll_windows.go
|
||||||
|
|
||||||
```
|
```go
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@ -119,14 +119,14 @@ func main() {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
A third way would be to call into libraries basically by "linking" against the library, using the "[cgo](wiki/cgo)" method (this way works in Linux and Windows):
|
A third way would be to call into libraries basically by "linking" against the library, using the "[[cgo]]" method (this way works in Linux and Windows):
|
||||||
|
|
||||||
This way would look something like this
|
This way would look something like this
|
||||||
|
|
||||||
```
|
```go
|
||||||
import ("C")
|
import ("C")
|
||||||
...
|
...
|
||||||
C.MessageBoxW(...)
|
C.MessageBoxW(...)
|
||||||
```
|
```
|
||||||
|
|
||||||
See [cgo](wiki/cgo) for further details.
|
See [[cgo]] for further details.
|
Loading…
x
Reference in New Issue
Block a user