代码块/mingw & Windres 使用 png 资源构建 .dll(VST 插件)时出现问题
我有一个 VST 插件,可以与 VS200X / MSVC 很好地编译。我正在尝试为喜欢该环境的用户制作一个 Codeblocks/MinGW 项目。
当我使用代码块构建 dll 时,它可以在 VST 主机中使用 GUI 运行,直到我开始尝试包含资源(.png 文件)为止,
我将 .rc 文件包含在代码块项目中。我的resource.h 中的资源路径没有空格。
如果我尝试复制构建的 .dll 文件,操作系统会将其锁定。几乎就好像 Windres 没有成功编译资源并保留了文件的句柄 - 尽管从 .dll 的大小来看,资源似乎在那里。如果我尝试通过 GDB 在 vst 主机中运行 dll,它不会遇到任何断点...大概主机无法加载 .dll。
这是代码块 cbp 编译器设置...
<Target title="Release Win32">
<Option output="build-win-cb\IPlugEffect" prefix_auto="1" extension_auto="1" />
<Option working_dir="build-win-cb\" />
<Option object_output="build-win-cb\Release" />
<Option type="3" />
<Option compiler="gcc" />
<Option parameters="IPlugEffect.dll" />
<Option host_application="C:\Program Files\vsthost\vsthost.exe" />
<Compiler>
<Add option="-O3" />
<Add option="-msse2" />
<Add option="-ffast-math" />
<Add option="-DVST_API" />
<Add option="-DWIN32" />
<Add option="-D_WIN32_WINNT=0x0501" />
<Add option="-DWINVER=0x0501" />
<Add option="-D_CRT_SECURE_NO_DEPRECATE" />
<Add option="-DPNG_NO_ASSEMBLER_CODE" />
<Add option="-DPNG_LIBPNG_SPECIALBUILD" />
<Add option="-DDLL_BUILD" />
</Compiler>
</Target>
resource.h
...
// Unique IDs for each image resource.
#define KNOB_ID 101
// Image resource locations for this plug.
...
IPlugEffect.rc
#include "resource.h"
KNOB_ID PNG KNOB_FN
#define KNOB_FN "resources/img/knob.png"
I have a VST plugin that compiles fine with VS200X / MSVC. I am trying to make a Codeblocks/MinGW project also for users who prefer that environment.
When I build the dll with codeblocks it works in a VST host, with GUI, until I start trying to include resources (.png files)
I include the .rc file in the codeblocks project. The resource paths in my resource.h don't have spaces.
If i try and copy the built .dll file the OS has it locked. It is almost as if windres is not compiling the resources successfully and retains a handle on the file - although by the size of the .dll it looks like the resources are there. If I try and run the dll in a vst host via GDB it doesn't hit any breakpoints... presumably the host can't load the .dll.
here are the codeblocks cbp compiler settings...
<Target title="Release Win32">
<Option output="build-win-cb\IPlugEffect" prefix_auto="1" extension_auto="1" />
<Option working_dir="build-win-cb\" />
<Option object_output="build-win-cb\Release" />
<Option type="3" />
<Option compiler="gcc" />
<Option parameters="IPlugEffect.dll" />
<Option host_application="C:\Program Files\vsthost\vsthost.exe" />
<Compiler>
<Add option="-O3" />
<Add option="-msse2" />
<Add option="-ffast-math" />
<Add option="-DVST_API" />
<Add option="-DWIN32" />
<Add option="-D_WIN32_WINNT=0x0501" />
<Add option="-DWINVER=0x0501" />
<Add option="-D_CRT_SECURE_NO_DEPRECATE" />
<Add option="-DPNG_NO_ASSEMBLER_CODE" />
<Add option="-DPNG_LIBPNG_SPECIALBUILD" />
<Add option="-DDLL_BUILD" />
</Compiler>
</Target>
resource.h
...
// Unique IDs for each image resource.
#define KNOB_ID 101
// Image resource locations for this plug.
...
IPlugEffect.rc
#include "resource.h"
KNOB_ID PNG KNOB_FN
#define KNOB_FN "resources/img/knob.png"
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题解决了。我的 dll 符号导出/可见性对于 gcc 来说不正确。
http://forum.cockos.com/showpost.php?p=835609& ;postcount=21
problem solved. My dll symbol exports/visibility were not correct for gcc.
http://forum.cockos.com/showpost.php?p=835609&postcount=21