Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > How to get standard C and C++ working together? How to debug a DLL?

Reply
Thread Tools

How to get standard C and C++ working together? How to debug a DLL?

 
 
Christian Graf
Guest
Posts: n/a
 
      08-11-2003
Hi,

(sorry if this post might occur two times, but I can't find my first
one from yesterday evening in this group)

I have a bigger VC++6.0 project which is successfully compiled into a
DLL. I had to combine this code with my one which worked fine for
itself. After integrating my code one into one of the classes the the
compiler threw errors. They disappeared after the compiler option
__STDC__ was removed. Apparently the larger project was build in full
conformance with the ANSI C standard. My code is C++ code (and can't
be rewritten), thus the errors when compiled with __STDC__ activated.
An additional __ANSI_CPP__ is defined in the DLL project as well, but
doesn't seem to harm or benefit to the build process of the combined
project.

The problem now is, that my DLL does compile without erros but doesn't
work when used by an EXE. It simply crashes. As a DLL has no console
output, how can I get some indication what goes wrong? How can I debug
a DLL with VC++? And most importantly: How can I integrate ANSI C and
VC++ in one project? Is there such a thing as guidelines, general
rules or special compiler settings?

Cheers
Chris
 
Reply With Quote
 
 
 
 
ak
Guest
Posts: n/a
 
      08-12-2003
On 11 Aug 2003 15:13:18 -0700, http://www.velocityreviews.com/forums/(E-Mail Removed) (Christian Graf)
wrote:

|The problem now is, that my DLL does compile without erros but doesn't
|work when used by an EXE. It simply crashes. As a DLL has no console
|output, how can I get some indication what goes wrong? How can I debug
|a DLL with VC++? And most importantly: How can I integrate ANSI C and
|VC++ in one project? Is there such a thing as guidelines, general
|rules or special compiler settings?

Since you are the author of the DLL it should be no problem to debug it,
just specify the .EXE as startup for your DLL in the debug options.
Alternatively you could build in trace output by using TRACE() / ATLTRACE() /
OutputDebugString in your DLL and use DBGViEW from www.sysinternals.com
to check the debug output.

your exported functions in the DLL must bear non-mangled names by specifying
them being extern "C" if they are to be used by a C program, there are also some
rules what you can export to a C-program - check your online help.

anyway try posting in microsoft.public.vc.language or any other suitable
microsoft.public NGs for better help.

hth
Anders

--
ak @ workmail.com
A wise man washes his hands after he pees. A wiser man doesn't pee on his hands.
 
Reply With Quote
 
 
 
 
Emry
Guest
Posts: n/a
 
      08-12-2003

"Christian Graf" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) om...
> Hi,
>

<snip>

In most cases, if you simply just include the C code, and compile the entire
thing as if it were C++, you should have no problems. Just make sure to
include the right include files for the appropriate C functions.



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
netvmini.sys still not working on Windows 7 even after driver signing disabled ?! (Windows debug mode necessary for debug drivers ???) Skybuck Flying Windows 64bit 3 08-09-2009 05:54 AM
HttpWebRequest Post with ClientCertificates working in Debug and VS, but not working in IIS calebmeii@gmail.com ASP .Net 0 06-29-2007 04:55 PM
debug="false" in web.config and <%@ debug="true" ...%> in aspx file => true or false? André ASP .Net 3 08-28-2006 12:02 PM
Config Mgr Debug/Release and Web.config Compilation debug=true RonL ASP .Net 0 04-08-2006 03:50 PM



Advertisments