Skip to content

Commit

Permalink
Merge pull request goplus#506 from xushiwei/q
Browse files Browse the repository at this point in the history
_wrap: llgo_check (to be continued)
  • Loading branch information
xushiwei authored Jul 13, 2024
2 parents ae09247 + 767a0cc commit 9edeee4
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 1 deletion.
7 changes: 7 additions & 0 deletions cpp/inih/_wrap/llgo_check.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include <stdio.h>
#include <INIReader.h>

int main() {
printf("sizeof(Reader) = %lu\n", sizeof(INIReader));
return 0;
}
16 changes: 16 additions & 0 deletions cpp/inih/_wrap/llgo_check.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package main

import (
"unsafe"

"github.com/goplus/llgo/c"
"github.com/goplus/llgo/cpp/inih"
)

const (
LLGoCFlags = "$(pkg-config --cflags INIReader)"
)

func main() {
c.Printf(c.Str("sizeof(Reader) = %lu\n"), unsafe.Sizeof(inih.Reader{}))
}
2 changes: 1 addition & 1 deletion cpp/inih/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (

// llgo:type C
type Reader struct {
Unused [24]byte
Unused [32]byte
}

// llgo:link (*Reader).InitFromBuffer C._ZN9INIReaderC1EPKcm
Expand Down
7 changes: 7 additions & 0 deletions cpp/std/_wrap/llgo_check.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include <stdio.h>
#include <string>

int main() {
printf("sizeof(std::string) = %lu\n", sizeof(std::string));
return 0;
}
12 changes: 12 additions & 0 deletions cpp/std/_wrap/llgo_check.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package main

import (
"unsafe"

"github.com/goplus/llgo/c"
"github.com/goplus/llgo/cpp/std"
)

func main() {
c.Printf(c.Str("sizeof(std::string) = %lu\n"), unsafe.Sizeof(std.String{}))
}
1 change: 1 addition & 0 deletions cpp/std/_wrap/string.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <string>
#include <new>

extern "C" {

Expand Down

0 comments on commit 9edeee4

Please sign in to comment.