Build DLLs with MinGW(--kill-at)

15 篇文章 0 订阅

 

Problem: As using link option --kill-at, the symbols of functions in DLL file is without '@x' when using

__stdcall. But the objects linking to the library still ask for symbols with '@x'.

The solution is to reproduce the implib bridging the linking symbols with and without '@x'.

 

 

 

Function definition:

 

 

Build DLL and create DEF file.

 

 

The DEF file:

 

 

Delete unnecessary symbols.

 

 

Create new implib.

 

 

Symbols in object file.

 

 

编译 freeglut.dll 的脚本:

 

  1 @echo off
  2
  3
  4 gcc -fPIC -c ./freeglut-2.6.0/src/*.c -D__MINGW32__ -DFREEGLUT_EXPORTS /

     -I./freeglut-2.6.0/include -I./freeglut    -2.6.0/src -I./freeglut-2.6.0/include/GL
  5
  6 gcc -shared -o freeglut.dll *.o /

     -Wl,--output-def,freeglut_origin.def,--out-implib,freeglut.dll.a,--kill-at -mwindows -lopengl32 -lglu32 -lwinmm
  7
  8 sed "s/glut.*/ =//g" freeglut_origin.def > freeglut.def
  9
 10 dlltool -d freeglut.def --dllname freeglut.dll --output-lib libfreeglut.dll.a --kill-at--
 11
 12 gcc -c freeglut-2.6.0/progs/demos/shapes/shapes.c -I./freeglut-2.6.0/include /

            -I./freeglut-2.6.0/src -I./freegl    ut-2.6.0/include/GL
 13
 14 gcc -o shapes.exe shapes.o -L. -lfreeglut -lopengl -mwindows
 15
 16 @pause

 

  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值