我就是找不到这个问题的解决方案..
我正在尝试做的是使用 gcc 调用汇编函数。随便看看:
// Somewhere in start.s
global _start_thread
_start_thread:
; ...
// Somewhere in UserThread.cpp
extern void _start_thread( pointer );
static void UserMainHack()
{
_start_thread(((UserThread*)currentThread)->getUserMain());
}
感谢任何帮助..
最佳答案
您知道许多 C 链接器在查找标识符时自动添加前导下划线吗?所以在 C 源代码中(不是汇编程序源代码),只需删除前导下划线:
extern void start_thread( pointer );
static void UserMainHack()
{
start_thread(((UserThread*)currentThread)->getUserMain());
}
关于c - undefined reference 在 C 中调用汇编函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12934233/