Com类调试方法
我正在使用 Visual Studio 2008 开发 COM 互操作类。 并在 Visual FoxPro 9.0 上使用这些类 当我编译类库时,它在编译后注册。
在 Visual FoxPro 上,我在命令窗口上使用以下代码片段创建对象:
newObj = CREATEOBJECT("CemT.Deneme.ClassTest")
当我想在 Visual Studio 上更改类库时,我无法再次编译和注册 dll。它给了我这个错误:
Unable to copy file "obj\Debug\clCOMTest.dll" to "bin\Debug\clCOMTest.dll". The process cannot access the file 'bin\Debug\clCOMTest.dll' because it is being used by another process.
有了这个错误,我将不得不退出 VFP 并重新开始。在创建对象之前,我在 Visual Studio 上编译类库。然后我就可以使用最新版本的dll了。
这看起来很正常,因为 VFP 使用了 dll,但是有没有办法在不重新启动 VFP 的情况下做到这一点?
I'm developing COM Interoperable classes using Visual Studio 2008.
And consuming these classes on Visual FoxPro 9.0
When I compiled the class library it is registering after compilation.
On Visual FoxPro I'm creating object with this code piece on Command window:
newObj = CREATEOBJECT("CemT.Deneme.ClassTest")
When I wanted to chage Class Library on Visual Studio I can't compile and register the dll again. It gives me this error:
Unable to copy file "obj\Debug\clCOMTest.dll" to "bin\Debug\clCOMTest.dll". The process cannot access the file 'bin\Debug\clCOMTest.dll' because it is being used by another process.
With this error I would have to quit VFP and start again. Before creating object I'm compiling the Class Library on Visual Studio. Then I can use the latest version of dll.
This looks very normal because of VFP using the dll but is there any way to do this without restarting VFP?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
在VFP中,您是否尝试过
RELEASE LIBRARY {您的dll文件}
,或者根据文档,您可以通过
SET LIBRARY TO
(没有任何特定库名称)来清除所有API库以清除它们
In VFP, have you tried
RELEASE LIBRARY {your dll file}
or, per documentation, you can clear ALL API libraries by
SET LIBRARY TO
(without any specific library name) to clear them
当我以前做这类事情时(设计用于与 VB 作为主机一起使用的 C++ COM 组件),我曾经设置“调试”命令行以在 VB 中打开正确的项目。
换句话说,我是在 C++ 调试器中运行 VB 开发环境。
这很好,因为我仍然可以在 DLL 等中设置断点,并同时在 VB 和 C++ 端工作。 (只要记住在 VB 中按“保存”,然后在 C++ 中按“停止”即可!)
执行相同的操作:
我从未使用过 FoxPro,但您可以使用 -C选项 microsoft.com/en-us/library/bzb50fbk(v=VS.71).aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/bzb50fbk(v=VS.71).aspx
Back when I used to do this type of thing (C++ COM components designed for use with VB as the host), I used to set the "Debug" command line to open the correct project in VB.
In other words I was running the VB development environment in the C++ debugger.
This was good because I can still set breakpoints in my DLL and so forth, and work on both the VB and C++ sides simultaneously. (Just remember to press "Save" in VB before you press "Stop" in C++!)
I have never used FoxPro, but you can probably do the same with the -C option:
http://msdn.microsoft.com/en-us/library/bzb50fbk(v=VS.71).aspx
这很简单,如果我正确理解这个问题,在VFP中,
Release newObj
It's quite simple, if I understand the issue correctly, in VFP,
Release newObj
在应用程序关闭之前,VFP 不会完全从内存中释放 COM 对象。
使用 RELEASE 命令不会完全释放它。
VFP does not totally release COM objects from memory until the application is closed.
Using the RELEASE command will not release it totally.