开发者

Crash using variables declared __declspec(thread)

I have a DLL (written in C) that uses static thread local storage (__declspec(thread)), and I want to use this DLL from a Visual Basic graphic interface.

Unfortunately, when running the interface on Windows XP that DLL which use static thread local storage crashes when it try to acess its thr开发者_Go百科ead variables.

How can I solve this problem?

Thanks, Regards

G.B.

PS I would like to not modify the DLL.


This is a known limitation of static TLS. Although you aren't explicitly calling LoadLibrary(), the VB runtime does so on your behalf.

Note that this limitation has been lifted from Vista. The most comprehensive reference that I know of is on Ken Johnson's blog.

You may be able to get around the problem if you could get the DLL included in the imports table of the generated .exe, which would likely involve some PE hacking and I'm far from certain it's a viable strategy. Otherwise you'll need to change the DLL.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜