Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

基础类型的变量怎么注册呢= =··· #46

Closed
yedemon opened this issue Dec 14, 2021 · 9 comments
Closed

基础类型的变量怎么注册呢= =··· #46

yedemon opened this issue Dec 14, 2021 · 9 comments
Labels
question Further information is requested

Comments

@yedemon
Copy link

yedemon commented Dec 14, 2021

尝试在inter.go 里面添加

var strdata string = "this is a string text!"
var intdata int = 0
var pintdata *int = &intdata
var uptr unsafe.Pointer = (unsafe.Pointer)(pintdata)

func init() ....

再尝试用loader去加载,就会各种抱怨
Load error: type:type.string not found
Load error: type:type.*int not found
Load error: type:type.unsafe.Pointer not found

用 RegType 似乎也不太好用,不知道这种类型的变量该怎么注册呢···

@pkujhd
Copy link
Owner

pkujhd commented Dec 14, 2021

@yedemon

RegTypes(symPtr, int(0), int8(0), int16(0), int32(0), int64(0),
		uint(0), uint8(0), uint16(0), uint32(0), uint64(0), true, &int0,
		float32(0), float64(0), complex64(0), complex128(0),
		"", []byte{}, []uint{}, []int{}, uintptr(0), make(chan bool, 1), unsafe.Pointer(&symPtr))

这些类型按理说你的loader都应该会用到才对

@pkujhd pkujhd closed this as completed Dec 14, 2021
@pkujhd pkujhd added the question Further information is requested label Dec 14, 2021
@yedemon
Copy link
Author

yedemon commented Dec 14, 2021

!!!按理说是会用到的,但是它就是不按理出牌没办法呢··· 我再试试你这个看看,

@yedemon
Copy link
Author

yedemon commented Dec 14, 2021

好像加了这个似乎还是抱怨找不到类型,我跟踪了一下,似乎是在 gcdata.go 的

typeName := linker.objsymbolMap[sym.Name].Type
if _, ok := linker.objsymbolMap[typeName]; !ok {
	return fmt.Errorf("type:%s not found\n", typeName)
}

这里报的错。似乎是 symbol is in loader, ignore generate gc data 这里的问题?

@pkujhd pkujhd reopened this Dec 14, 2021
@yedemon
Copy link
Author

yedemon commented Dec 14, 2021

emm... 需要补充什么信息么···

@pkujhd
Copy link
Owner

pkujhd commented Dec 15, 2021

不需要了,global变量的gc有问题,短时间估计修正不了

@yedemon
Copy link
Author

yedemon commented Dec 15, 2021

QωQ··· 好的··· 谢谢大大喏··· 辛苦

@pkujhd pkujhd closed this as completed in 30e31f9 Jan 14, 2022
@pkujhd
Copy link
Owner

pkujhd commented Jan 14, 2022

@yedemon , 尝试性修复,有问题reopen it

@pkujhd
Copy link
Owner

pkujhd commented Jan 28, 2022

@yedemon 64101bc version fix it

@yedemon
Copy link
Author

yedemon commented Feb 15, 2022

谢大神!我回头看一下!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants