pkujhd / goloader

load and run golang code at runtime.
Apache License 2.0
506 stars 58 forks source link

Does it support recursive functions? #100

Closed dzzzc closed 4 months ago

dzzzc commented 4 months ago

I found that recursive calls fail PixPin_2024-07-03_17-31-01 PixPin_2024-07-03_17-31-28

pkujhd commented 4 months ago

@dengzhicong
in your case. you just read objects, but not Load, Load function will relocate symbol and get position for symbol.

dzzzc commented 4 months ago

Sorry, it was an internal error in this function goloader.Load(linker, symPtr) PixPin_2024-07-03_18-05-38

eh-steve commented 4 months ago

Seems ok on my fork… https://github.com/eh-steve/goloader/commit/88d85dba9ea882c36aef678a0acbf4ffac167cb5

pkujhd commented 4 months ago

Seems ok on my fork… eh-steve@88d85db

i test eh-steve's case, my repos is ok too.

@dengzhicong please provide a reproducible case

dzzzc commented 4 months ago

This is my test code

https://github.com/dengzhicong/go-plugin-benchmark

pkujhd commented 4 months ago

This is my test code

https://github.com/dengzhicong/go-plugin-benchmark

If the function you call depends on another library's function, then you need to load it at same time.

pkujhd commented 4 months ago

you may use eh-steve's fork, this fork auto load dependent library.

dzzzc commented 4 months ago

ok. Thank You