VB - 以隐式方式链接 DLL [英] VB - Linking a DLL in implicit way

查看:21
本文介绍了VB - 以隐式方式链接 DLL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发 VB6 图形界面,我需要隐式链接到 DLL.

I'm working on a VB6 graphic interface and I need to make an implicit linking to a DLL.

这样做的动机来自我的上一个问题.有问题的 DLL 使用静态 TLS,__declspec(thread),当然,当使用 LoadLibray 显式链接 DLL 时,这会严重失败.

The motivation for this comes from my previous question. The DLL in question uses static TLS, __declspec(thread), and of course this fails horribly when the DLL is linked explicitly using LoadLibray.

我真的很想避免修改 DLL,那么有谁知道如何欺骗 VB6 可执行文件以隐式链接到特定的 DLL?

I'd really like to avoid modifications to the DLL, so does anyone know how to trick a VB6 executable to link to a specific DLL implicitly?

推荐答案

为您的 DLL 创建一个 IDL 文件,在 module子句.

Create an IDL file for your DLL that describes your exported functions in a moduleclause.

使用 MIDL 编译器进行编译,并从您的 VB6 项目(项目 - 参考)中引用生成的 tlb 文件.
并删除所有Declare Function.

Compile with the MIDL compiler and reference the resulting tlb file from your VB6 project (Project - References).
And remove all Declare Functions.

tlb 文件仅用于编译(在这种情况下),您不必将其包含在设置中.

The tlb file is only used for compilation (in this case), you don't have to include it into the setup.

这篇关于VB - 以隐式方式链接 DLL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆