Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
devlights committed Apr 23, 2024
1 parent 87fee35 commit 72ccdaa
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
12 changes: 12 additions & 0 deletions 22.C_SRCDIR/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,18 @@ import "C"
import "C"
```

この場合は、以下のようにします。

```go
/*
#cgo CFLAGS: -I${SRCDIR}/libs
#cgo LDFLAGS: -L${SRCDIR}/libs -llibs
#include "libs.h"
*/
import "C"
```


この値は、実行時に現在のソースファイルのディレクトリに置換されます。ディレクトリパスは絶対パスで展開されます。

Expand Down
3 changes: 2 additions & 1 deletion 22.C_SRCDIR/main.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package main

/*
#cgo CFLAGS: -I${SRCDIR}/libs
#cgo LDFLAGS: -L${SRCDIR}/libs -llibs
#include "libs/libs.h"
#include "libs.h"
*/
import "C"
import "log"
Expand Down

0 comments on commit 72ccdaa

Please sign in to comment.