Logo
Explore Help
Register Sign In
admin/llgo
1
0
Fork 0
You've already forked llgo
Code Issues Pull Requests Actions Packages Projects Releases Wiki Activity
Files
060a2dea06cefbe8b0d127ba5394cd378c355e8f
llgo/_demo/embedded/export_test/main.go

23 lines
331 B
Go
Raw Normal View History

feat: support //export with different symbol names for embedded targets Implements support for TinyGo-style //export directive that allows exporting functions with symbol names different from the Go function name. This is essential for embedded development where hardware specifications require specific symbol names (e.g., ARM Cortex-M interrupt handlers like LPSPI2_IRQHandler, SysTick_Handler). Changes: - Modified cl/import.go to support two export formats: 1. //export ExportName (TinyGo-style, export name can differ from function name) 2. //export FuncName ExportName (Go-style, explicit function and export names) - Added test case in _demo/embedded/export_test/ with nm verification Example usage: //export LPSPI2_IRQHandler func interruptLPSPI2() { // exported as LPSPI2_IRQHandler } Fixes #1378 🤖 Generated with [codeagent](https://github.com/qbox/codeagent) Co-authored-by: luoliwoshang <51194195+luoliwoshang@users.noreply.github.com>
2025-10-31 03:31:39 +00:00
package main
//export LPSPI2_IRQHandler
func interruptLPSPI2() {
println("LPSPI2 interrupt handled")
}
//export SysTick_Handler
func systemTickHandler() {
println("System tick")
}
//export Add
func Add(a, b int) int {
return a + b
}
func main() {
interruptLPSPI2()
systemTickHandler()
println("Add(2, 3) =", Add(2, 3))
}
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.25.2 Page: 201ms Template: 40ms
English
Bahasa Indonesia Deutsch English Español Français Gaeilge Italiano Latviešu Magyar nyelv Nederlands Polski Português de Portugal Português do Brasil Suomi Svenska Türkçe Čeština Ελληνικά Български Русский Українська فارسی മലയാളം 日本語 简体中文 繁體中文(台灣) 繁體中文(香港) 한국어
Licenses API