Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The problem of static Link Library compiled by ffmpeg

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

Ffmpeg is installed to compile dll and .a files in wince, but it is found that this .a file is not like the lib file under win32, which cannot be called directly. If it is called directly, it will generate error LNK2001: unresolved external symbol _ _ alloca and error LNK2001: unresolved external symbol _ _ divdi3 and error LNK2001: unresolved external symbol _ _ umoddi3. The call to three external library files fails, but I think there are some things in different lib that are not available in the file. To be able to use your vc or generate it into a lib file is better, the following combined with their own experience on how to generate lib file, record csdn above lest you forget. There is already such a tool in mingw called dlltool, but this has not been seen. Later, we will talk about a method of win32. What if we already have a dll (we can compile ffmpeg to get it), but we do not have a lib file? There is such a tool under vc, called DUMPBIN, which can export dll to a def file to describe the interface of dll, DUMPBIN VideoDeCoder.dll / EXPORTS / OUT:VideoDeCoder.def we can find this file under vc's bin, OK, now we can run this dumpbin and then we can use our dll, our dll has three avcodec.dll, avformat.dll and avutil.dll, so we can generate three def files The next step is how to turn these three dll into lib. This def file is not a special lib def file but has a dll, we need to change it into lib and some modifications. Original file Dump of file C:\\ Program Files\\ FFmpeg\\ avutil.dllFile

Type: DLL Section contains the following exports for avutil.dll

00000000 characteristics

49659AAD time date stamp Thu Jan 08 14:18:21 2009

0.00 version

1 ordinal base

34 number of functions

34 number of names

Ordinal hint RVA

Name

1 0 00001C70 av_add_i

2 1 00002850 av_add_q

3 2 00001F10 av_cmp_i

4 3 00003130 av_crc

5 4 00005080 av_crc04C11DB7

6 5 00005090 av_crc07

7 6 00005060 av_crc8005

8 7 00005070 av_crcEDB88320

9 8 00003000 av_crc_init

10 9 00002940 av_d2q

11 A 00002AB0 av_dbl2ext

12 B 00002E30 av_dbl2int

13 C 00002420 av_div_i

14 D 00002800 av_div_q

15 E 00002D40 av_ext2dbl

16 F 00002F30 av_flt2int

17 10 000024D0 av_i2int

18 11 00002C00 av_int2dbl

19 12 00002CC0 av_int2flt

20 13 00002480 av_int2i

21 14 00001D30 av_log2_i

22 15 00001FF0 av_mod_i

23 16 00001D80 av_mul_i

24 17 000027B0 av_mul_q

25 18 00002510 av_reduce

26 19 000016A0 av_rescale

27 1A 00001980 av_rescale_q

28 1B 000013B0 av_rescale_rnd

29 1C 00001F60 av_shr_i

30 1D 00001CD0 av_sub_i

31 1E 000028C0 av_sub_q

32 1F 00001350 ff_gcd

33 20 00001250 ff_log2_tab

34 21 000011D0 ff_sqrt_tab

Summary

1000 .bss

1000 .data

1000 .edata

1000 .idata

1000 .reloc

3000. File after text transformation:

LIBRARY "avutil"

DESCRIPTION "avutil"

EXPORTS

Av_add_i @ 1

Av_add_q @ 2

Av_cmp_i @ 3

Av_crc @ 4

Av_crc04C11DB7 @ 5

Av_crc07 @ 6

Av_crc8005 @ 7

Av_crcEDB88320 @ 8

Av_crc_init @ 9

Av_d2q @ 10

Av_dbl2ext @ 11

Av_dbl2int @ 12

Av_div_i @ 13

Av_div_q @ 14

Av_ext2dbl @ 15

Av_flt2int @ 16

Av_i2int @ 17

Av_int2dbl @ 18

Av_int2flt @ 19

Av_int2i @ 20

Av_log2_i @ 21

Av_mod_i @ 22

Av_mul_i @ 23

Av_mul_q @ 24

Av_reduce @ 25

Av_rescale @ 26

Av_rescale_q @ 27

Av_rescale_rnd @ 28

Av_shr_i @ 29

Av_sub_i @ 30

Av_sub_q @ 31

1ff_gcd @ 32

Ff_log2_tab @ 33

Ff_sqrt_tab @ 34 puts all functions at the beginning of the line, removes the "hint" and "RVA" data, leaves the function sequence number "ordinal", and preplaces the "@" symbol before the sequence number to form the format "_ derived function name @ parameter byte and @ sequence number" (the exported function symbol is "function name @ parameter byte and" in _ _ stdcall mode). The final .DEF file is as follows:

Use VC++ 's LIB tool with / DEF: (.def file name) / MACHINE:IX86 (80X86 machine) to output LIB files in VC++ format. EXAMPLE: LIB / DEF:avutil.def / MACHINE:IX86 with LIB file link Note that when some dynamic library DUMPBIN has only the function name, no "@ nn" parameter format, such as DLL written by C++Builder, the output will only have the function name symbol, and the link will report an error: the function symbol introduced in the error LNK2002:unresolved external symbol "functionname@nn" prompt program can not be recognized, then just change the corresponding function name in the DEF file to functionname@nn mode, re-establish LIB, and re-link. When mspdb80.dll cannot be found, typing cl in cmd will cause a situation that mspdb80.dll cannot find when compiling, because there are no four files called "msobj80.dll,mspdb80.dll,mspdbcore.dll,mspdbsrv.exe" under VC\ Bin\. The solution:

1 > it can be solved by copying these four files directly from Common7\ IDE\ to VC\ Bin\

2 > add the system variable (Path) so that: my computer-> Properties-> Advanced-> Environment variable-> system variable, add C:\ Program Files\ Microsoft Visual Studio 8\ Common7\ IDE;, to the path and note that it ends with ";" separated!

In this way, there will be no errors that can not be found in the mspdb80.dll file when compiling with cl.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report