调试中构建 [英] building in debugging

查看:116
本文介绍了调试中构建的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个程序,该程序使用dll作为其主系统,在其中创建了一个调试系统,该系统报告文件或sdtout或两者.

但是对于发行版,我希望使用单独的应用程序作为接收调试跟踪的控制台.

我希望它独立于应用程序(.exe),所以我想出了两种使用方法,并想知道这两种方法是否都适用于我的需求.

1.使用DDE将信息发送到外部应用程序.

2.在dll本身中创建一个单独的进程,并在其中创建一个充当调试应用程序线程的线程(如果创建进程不提供初始线程).如果.exe启动dll,如果.exe爆炸,第二个进程是否会挂起而不会产生不利影响?

I have created a program which uses a dll as its main system, in which I have created a debug system which reports to a file or sdtout or both.

but for a release version I wish to use a seperate application to use as a console for receiving the debug trace.

I want it to be independant of the application (.exe) so I have thaught of two methods to use and would like to know if either are applicable to what i need.

1. Use DDE to send info to an external app.

2. in the dll itself create a seperate process and inside it, a thread to act as the debug app thread ( if creating a process doesn''t provide an initial thread. ) -> If the .exe initiates the dll, will a second process hang around without adverse effects if the .exe goes bang?

推荐答案

BTW,这是不受管理的代码,还是.净吗?

您不能将DLL作为进程运行.几年前,我不得不做同样的事情,而我只是通过在应用程序之间来回发送注册消息来使用进程间通信.您可以在应用程序之间发送指向字符串的指针.有许多非COM方法可以实现所需的功能:

从完整性上讲,有许多方法可以实现不涉及COM/DDE的进程间通信.

0)所有适用的应用程序都知道的已注册消息
1)命名管道
2)TCP/IP套接字
3)通过DLL共享内存.

恕我直言,最好在应用程序中创建一个无模式窗口,供用户通过热键或菜单选择(或两者)显示/隐藏,并将其代码粘贴到DLL中.这样,您的应用程序将使用DLL(如果存在),或者在没有DLL的情况下正常运行.
BTW, is this unmanaged code, or .Net?

You can''t run a DLL as a process. I had to do the same thing a bunch of years ago, and I just used interprocess comms by sending registered messages back and forth between the apps. You can send pointers to strings between the apps. There are a number of non-COM methods for accomplishing what you want:

In the ineterest of completeness, there are a number of ways to implement interprocess comms that don''t involve COM/DDE.

0) Registered messages that all of the applicable applications know about
1) Named pipes
2) TCP/IP sockets
3) Shared memory via a DLL.

IMHO, you''d be better off creating a modeless window in your application that the user can show/hide via hotkey or menu selection (or both), and stick the code for it into a DLL. That way, your app would use the DLL if it''s there, or run normally without it.


^ ]正是您需要的-灵活而健壮的日志记录机制

以下是有关使用ACE日志记录功能 [
ACE[^] has just what you need - a flexible robust mechanism for logging

Here is a wee bit of info on Using the ACE Logging Facility[^]

From your description, I would guess you could benefit from using ACE in a number of other ways too :)

Regards
Espen Harlinn


不确定您要做什么,但是创建线程并不难.您只需要注意不要创建过多的死锁和争用条件.
Not sure what you are trying to do, but it isn''t difficult to create threads. You just have to be careful that you neither create too many nor create deadlocks and race conditions.


这篇关于调试中构建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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