[Expat-discuss] Parser that uses Expat "stops working" in Win32/MFC program?

warren henning w_k_henning at hotmail.com
Wed Jul 23 18:18:56 EDT 2003


I wrote a program which uses the Expat parser in C to run in a console (DOS) 
environment.

I changed that code around a little bit so that I could call the important 
functions from other parts of my Windows program (I'm using Visual C++ 6 
SP5). Basically what happens is a function that my program calls does all 
the Expat-based parsing and returns a data structure with all the 
information my program needs. To call the function you don't have to know 
how Expat works (that was kind of the point).

But the parser seems to not be filling out the fields of the data structure. 
The same code worked under DOS just fine, even when I adapted it so that a 
test file with a short main() function just called the function in the code 
I wrote to do all the parsing.

Now I figured problems might arise from trying to use C code with C++, but 
(the filenames for my code are rss_process.c and rss_process.h) as long as I 
include 'extern C { #include "rss_process.h"' in the C++ file that wants to 
call the C functions it seems to work fine.

I added debugging statements to the important functions in my parser's code 
(the start() and end() callback functions that are provided to Expat) -- 
essentially they output data to a file. I added statements to simply output 
"in function (whatever)" to see if the functions were even called and 
apparently they aren't because the statements that should have appeared in 
the output file are non-existent.

What could cause working code (the parser code was working fine under DOS) 
to break under Win32/MFC/C++ environment? I've been trying to get this to 
work for a few days and I'm pretty much stumped. If anyone wants to see the 
actual code I can put it on the Internet.

Thanks in advance!

-Warren

_________________________________________________________________
Add photos to your e-mail with MSN 8. Get 2 months FREE*.  
http://join.msn.com/?page=features/featuredemail




More information about the Expat-discuss mailing list