ICode9

精准搜索请尝试: 精确搜索
首页 > 系统相关> 文章详细

Windows函数转发器

2020-01-25 23:56:42  阅读:466  来源: 互联网

标签:comment 函数 Windows libx264 linker 159 转发器 pragma x264


最近MSYS2升级后出现了一个bug,libxml264-157.dll被升级成了libxml264-159.dll,但是ffplay还依赖libxml264-157.dll,本来打算直接复制一个libxml264-159.dll重命名为libxml264-157.dll,但是发现libxml264-157.dll里面有一个函数x264_encoder_open_157在libxml264-159.dll变成了x264_encoder_open_159,这样程序就会找不到x264_encoder_open_157这个函数,最后我通过函数转发器解决了这个问题。函数转发器的声明如下:

// Function forwarders to functions in DllWork
#pragma comment(linker, "/export:SomeFunc=DllWork.SomeOtherFunc")

在Visual Studio中新建一个动态链接库项目,命名为libxml264-157,添加以下代码:

#pragma comment(linker, "/EXPORT:x264_10_frame_pop=libx264-159.x264_10_frame_pop")
#pragma comment(linker, "/EXPORT:x264_10_frame_push=libx264-159.x264_10_frame_push")
#pragma comment(linker, "/EXPORT:x264_10_frame_shift=libx264-159.x264_10_frame_shift")
#pragma comment(linker, "/EXPORT:x264_10_frame_unshift=libx264-159.x264_10_frame_unshift")
#pragma comment(linker, "/EXPORT:x264_10_threadpool_delete=libx264-159.x264_10_threadpool_delete")
#pragma comment(linker, "/EXPORT:x264_10_threadpool_init=libx264-159.x264_10_threadpool_init")
#pragma comment(linker, "/EXPORT:x264_10_threadpool_run=libx264-159.x264_10_threadpool_run")
#pragma comment(linker, "/EXPORT:x264_10_threadpool_wait=libx264-159.x264_10_threadpool_wait")
#pragma comment(linker, "/EXPORT:x264_8_frame_pop=libx264-159.x264_8_frame_pop")
#pragma comment(linker, "/EXPORT:x264_8_frame_push=libx264-159.x264_8_frame_push")
#pragma comment(linker, "/EXPORT:x264_8_frame_shift=libx264-159.x264_8_frame_shift")
#pragma comment(linker, "/EXPORT:x264_8_frame_unshift=libx264-159.x264_8_frame_unshift")
#pragma comment(linker, "/EXPORT:x264_8_threadpool_delete=libx264-159.x264_8_threadpool_delete")
#pragma comment(linker, "/EXPORT:x264_8_threadpool_init=libx264-159.x264_8_threadpool_init")
#pragma comment(linker, "/EXPORT:x264_8_threadpool_run=libx264-159.x264_8_threadpool_run")
#pragma comment(linker, "/EXPORT:x264_8_threadpool_wait=libx264-159.x264_8_threadpool_wait")
#pragma comment(linker, "/EXPORT:x264_chroma_format=libx264-159.x264_chroma_format")
#pragma comment(linker, "/EXPORT:x264_cpu_detect=libx264-159.x264_cpu_detect")
#pragma comment(linker, "/EXPORT:x264_cpu_names=libx264-159.x264_cpu_names")
#pragma comment(linker, "/EXPORT:x264_cpu_num_processors=libx264-159.x264_cpu_num_processors")
#pragma comment(linker, "/EXPORT:x264_encoder_close=libx264-159.x264_encoder_close")
#pragma comment(linker, "/EXPORT:x264_encoder_delayed_frames=libx264-159.x264_encoder_delayed_frames")
#pragma comment(linker, "/EXPORT:x264_encoder_encode=libx264-159.x264_encoder_encode")
#pragma comment(linker, "/EXPORT:x264_encoder_headers=libx264-159.x264_encoder_headers")
#pragma comment(linker, "/EXPORT:x264_encoder_intra_refresh=libx264-159.x264_encoder_intra_refresh")
#pragma comment(linker, "/EXPORT:x264_encoder_invalidate_reference=libx264-159.x264_encoder_invalidate_reference")
#pragma comment(linker, "/EXPORT:x264_encoder_maximum_delayed_frames=libx264-159.x264_encoder_maximum_delayed_frames")
#pragma comment(linker, "/EXPORT:x264_encoder_open_157=libx264-159.x264_encoder_open_159")
#pragma comment(linker, "/EXPORT:x264_encoder_parameters=libx264-159.x264_encoder_parameters")
#pragma comment(linker, "/EXPORT:x264_encoder_reconfig=libx264-159.x264_encoder_reconfig")
#pragma comment(linker, "/EXPORT:x264_free=libx264-159.x264_free")
#pragma comment(linker, "/EXPORT:x264_levels=libx264-159.x264_levels")
#pragma comment(linker, "/EXPORT:x264_log_default=libx264-159.x264_log_default")
#pragma comment(linker, "/EXPORT:x264_log_internal=libx264-159.x264_log_internal")
#pragma comment(linker, "/EXPORT:x264_malloc=libx264-159.x264_malloc")
#pragma comment(linker, "/EXPORT:x264_mdate=libx264-159.x264_mdate")
#pragma comment(linker, "/EXPORT:x264_nal_encode=libx264-159.x264_nal_encode")
#pragma comment(linker, "/EXPORT:x264_param2string=libx264-159.x264_param2string")
#pragma comment(linker, "/EXPORT:x264_param_apply_fastfirstpass=libx264-159.x264_param_apply_fastfirstpass")
#pragma comment(linker, "/EXPORT:x264_param_apply_profile=libx264-159.x264_param_apply_profile")
#pragma comment(linker, "/EXPORT:x264_param_default=libx264-159.x264_param_default")
#pragma comment(linker, "/EXPORT:x264_param_default_preset=libx264-159.x264_param_default_preset")
#pragma comment(linker, "/EXPORT:x264_param_parse=libx264-159.x264_param_parse")
#pragma comment(linker, "/EXPORT:x264_picture_alloc=libx264-159.x264_picture_alloc")
#pragma comment(linker, "/EXPORT:x264_picture_clean=libx264-159.x264_picture_clean")
#pragma comment(linker, "/EXPORT:x264_picture_init=libx264-159.x264_picture_init")
#pragma comment(linker, "/EXPORT:x264_reduce_fraction=libx264-159.x264_reduce_fraction")
#pragma comment(linker, "/EXPORT:x264_reduce_fraction64=libx264-159.x264_reduce_fraction64")
#pragma comment(linker, "/EXPORT:x264_slurp_file=libx264-159.x264_slurp_file")
#pragma comment(linker, "/EXPORT:x264_threading_init=libx264-159.x264_threading_init")

生成libxml264-157.dll,就解决了这个问题。

标签:comment,函数,Windows,libx264,linker,159,转发器,pragma,x264
来源: https://www.cnblogs.com/JebediahKerman/p/Windows_Function_Forwarder.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有