Code Monkey home page Code Monkey logo

Comments (7)

ParkourLiu avatar ParkourLiu commented on August 16, 2024

package main

import (
"fmt"
"time"
)

func main() {
for _, v := range []int{1, 2, 3, 4, 5} {
go func(v int) {
for {
time.Sleep(time.Second)
}
}(v)
}
fmt.Println(11)
select {}
}

from goloader.

ParkourLiu avatar ParkourLiu commented on August 16, 2024

以上代码。使用goloader加载运行时,因为select{} ,会报错unresolve external:runtime.block

from goloader.

ParkourLiu avatar ParkourLiu commented on August 16, 2024

还有使用了第三方库里面。。应该也是有哪个关键字吧。。。会报unresolve external:runtime.chanrecv2

from goloader.

pkujhd avatar pkujhd commented on August 16, 2024

以上代码。使用goloader加载运行时,因为select{} ,会报错unresolve external:runtime.block

你要在动态时候使用select的特性,则需要loader也使用,这样运行时才有这个函数符号,因为这个是go的系统内部函数,所以无法使用register来注册它

例如这个runtime.block 你需要在loader里边也有select{}

from goloader.

ParkourLiu avatar ParkourLiu commented on August 16, 2024

runtime.chanrecv2是什么没有注册进去呢?搜索出来是chan的底层会用到runtime.chanrecv2,可是我在loader中声明并初始化了一个chan后,还是报这个错误

from goloader.

pkujhd avatar pkujhd commented on August 16, 2024

runtime.chanrecv2是什么没有注册进去呢?搜索出来是chan的底层会用到runtime.chanrecv2,可是我在loader中声明并初始化了一个chan后,还是报这个错误

只声明没有用,需要使用这个channel, 应该recv一下就会底层用到runtime.chanrecv2这个函数

from goloader.

ParkourLiu avatar ParkourLiu commented on August 16, 2024
    c := make(chan bool, 2)
c <- true
v, ok := <-c
fmt.Println(v, ok)

调试下来发现,使用v := <-c还是会报runtime.chanrecv2,必须使用第三行的v, ok := <-c,底层才会调用runtime.chanrecv2这个函数,才不会报错了。。。谢谢大神指点!

from goloader.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.