过程如下所示:

/* shrobj.c 文件 */
const char *myfunc()
{
    return "Hello World";
}


/* hello.c 文件 */
#include <stdio.h>

extern const char *myfunc();

main()
{
    printf("%s\n", myfunc());
    return 0;
}


编译:
  gcc -fpic -c shrobj.c
  gcc -shared -o -fpic shared.dll shrobj.o
  gcc -o hello.exe hello.c shared.dll

运行:
  hello.exe
  Hello World

相关文章:

  • 2022-12-23
  • 2021-06-25
  • 2021-09-20
  • 2021-06-21
  • 2022-12-23
猜你喜欢
  • 2021-09-29
  • 2021-11-22
  • 2021-04-11
  • 2021-07-18
  • 2021-04-03
  • 2021-08-29
  • 2022-12-23
相关资源
相似解决方案