Windows - samples fail on "transform(...)" when using "cout"

View: New views
7 Messages — Rating Filter:   Alert me  

Windows - samples fail on "transform(...)" when using "cout"

by Ellonnic2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

Many of Xalan's samples redirect the program's output to stdout by passing in "cout" as the last parameter to the "transform(...)" method.  This works fine with the executables provided along with the binary distribution of Xalan.  However, if I instead build the sample source-code myself using Visual Studio 2005, I get a crash/exception whenever I execute any transform call using "cout" as the last parameter (the attached XalanTransform.cpp has the simplest example of this).  

theResult = theXalanTransformer.transform(argv[1], argv[2], cout);

Does anyone know why this happens and/or how to prevent it???

Thanks in advance for your time and patience,
~Dan
XalanTransform.cpp

Re: Windows - samples fail on "transform(...)" when using "cout"

by David Bertoni :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ellonnic2 wrote:

> Hello,
>
> Many of Xalan's samples redirect the program's output to stdout by passing
> in "cout" as the last parameter to the "transform(...)" method.  This works
> fine with the executables provided along with the binary distribution of
> Xalan.  However, if I instead build the sample source-code myself using
> Visual Studio 2005, I get a crash/exception whenever I execute any transform
> call using "cout" as the last parameter (the attached XalanTransform.cpp has
> the simplest example of this).  
>
> theResult = theXalanTransformer.transform(argv[1], argv[2], cout);
>
> Does anyone know why this happens and/or how to prevent it???
That seems very strange. Some questions:

1. Did you also build Xerces-C from source source, or did you download
the binary distribution?

2. How did you build Xalan-C 1.10 using VS2005? You would need to make a
lot of source code changes to build it (the current repository version
builds with VS2005).

3. Have you run your executable in the debugger to determine where the
access violation occurs?

Dave

Re: Windows - samples fail on "transform(...)" when using "cout"

by Ellonnic2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Dave,

Thanks for your reply.

I only built the sample code, not the Xalan or Xerces source code itself.  To be more specific, I downloaded and used the binary distribution of both Xerces (xerces-c_2_7_0-windows_2000-msvc_60.zip) and Xalan (Xalan-C_1_10_0-win32-msvc_60.zip).

Trying to step over this very line:
theResult = theXalanTransformer.transform(argv[1], argv[2], cout);
consistently causes the "Unhandled exception at ... in XalanTransform.exe: ...: Access violation reading location ...." failure.

Is it because I'm using Visual Studio 2005 to build this and the binaries were built using Visual C++ 6.0?  If so, how do resolve that without having to upgrade Visual Studio versions?o

~Dan

Re: Windows - samples fail on "transform(...)" when using "cout"

by David Bertoni :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ellonnic2 wrote:

> Hi Dave,
>
> Thanks for your reply.
>
> I only built the sample code, not the Xalan or Xerces source code itself.
> To be more specific, I downloaded and used the binary distribution of both
> Xerces (xerces-c_2_7_0-windows_2000-msvc_60.zip) and Xalan
> (Xalan-C_1_10_0-win32-msvc_60.zip).
>
> Trying to step over this very line:
> theResult = theXalanTransformer.transform(argv[1], argv[2], cout);
> consistently causes the "Unhandled exception at ... in XalanTransform.exe:
> ...: Access violation reading location ...." failure.
>
> Is it because I'm using Visual Studio 2005 to build this and the binaries
> were built using Visual C++ 6.0?  If so, how do resolve that without having
> to upgrade Visual Studio versions?o
You can't mix the binaries built with VS6 with binaries you built with
VS2005 -- Microsoft's run-time libraries are not compatible.

If you need to build with VS2005, first download the Xerces-C vs2005
binaries, or build Xerces-C 3.0.1 from the source code:

http://apache.securedservers.com/xerces/c/3/binaries/xerces-c-3.0.1-x86-windows-vc-8.0.zip
http://apache.securedservers.com/xerces/c/3/sources/xerces-c-3.0.1.zip

Then, you'll need to check out the latest Xalan-C source code from the
Subversion repository. It's fairly easy to do using a GUI program like
TortoiseSVN:

http://tortoisesvn.net/downloads

After you install TortoiseSVN, open Windows Explorer and navigate to the
folder where you want to check out the sources.  Right-click in the
folder, then enter the following URL in the edit field:

http://svn.apache.org/repos/asf/xalan/c/trunk

You can also specify a subdirectory or the checkout in the second edit
field, if you want.

Then, you can follow the Windows build instructions here:

http://xml.apache.org/xalan-c/build_instruct.html#dotNet

Note you'll need to open the project files for VC8 instead of VC7.1,
since you're using VS2005. Also, please make sure you put the Xerces-C
DLLs (both debug and release) somewhere on your path, so they will be
found during the Xalan-C build process. I typically add the Xerces-C
output directories to the path, but you may find it easier to put them
in a single directory and put that directory on your path.

If you have any questions or problems, just post a reply.

Dave

Re: Windows - samples fail on "transform(...)" when using "cout"

by Ellonnic2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Dave,

Thanks so much for your reply.  I think I'm 98% of the way there.  I just have one minor issue.  Once I have everything seemingly set up correctly, when I build, I get the following:

"Cannot open include file: 'LocalMsgIndex.hpp': No such file or directory"
and then lots of
"fatal error C1083: Cannot open include file: 'LocalMsgIndex.hpp': No such file or directory"

Now, I understand that there is a FAQ for the "Missing LocalMsgIndex.hpp file", however, this seemingly only tells me that this file should have been generated.  Does this error force me to now have to build with ICU support?  When I changed the target from "Debug with ICU" to "Debug", it had no effect.

Changing topics, on the Xalan download site ("http://xml.apache.org/xalan-c/download.html"), I do not see any Macintosh information, but the source code has a "c\Projects\MacOS" directory.  Which OSes does the most recent source code support that is not on the site's list?

Re: Windows - samples fail on "transform(...)" when using "cout"

by David Bertoni :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ellonnic2 wrote:

> Hi Dave,
>
> Thanks so much for your reply.  I think I'm 98% of the way there.  I just
> have one minor issue.  Once I have everything seemingly set up correctly,
> when I build, I get the following:
>
> "Cannot open include file: 'LocalMsgIndex.hpp': No such file or directory"
> and then lots of
> "fatal error C1083: Cannot open include file: 'LocalMsgIndex.hpp': No such
> file or directory"
This usually occurs because the Xerces-C DLL cannot be located, so the
message generation utility can't execute.  Please make sure the Xerces-C
directories that contain the debug and release Xerces-C DLLs are on your
path. Alternatively, you can copy those binaries to the appropriate
Xalan-C output directories. To do this, I usually just build the
MsgCreator project for the configurations I'm interested in, then copy
the appropriate binaries into the resulting output directories under the
Build directory.  Remember to copy the release DLL to any release
configuration output directories and the debug DLL to any debug
configuration output directories.

> Now, I understand that there is a FAQ for the "Missing LocalMsgIndex.hpp
> file", however, this seemingly only tells me that this file should have been
> generated.  Does this error force me to now have to build with ICU support?
> When I changed the target from "Debug with ICU" to "Debug", it had no
> effect.
That won't fix the problem, since the issue is you're missing the
Xerces-C DLLs.

> Changing topics, on the Xalan download site
> ("http://xml.apache.org/xalan-c/download.html"), I do not see any Macintosh
> information, but the source code has a "c\Projects\MacOS" directory.  Which
> OSes does the most recent source code support that is not on the site's
> list?
That configuration has not been maintained for many years, and in fact,
it's project files for Apple's ProjectBuilder IDE, which is no longer
being developed.

Dave


Re: Windows - samples fail on "transform(...)" when using "cout"

by Ellonnic2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I feel so foolish.  You were absolutely right about the DLL.  The batch file I wrote that started VS2005 was trying to use a quote (") to set the path environment variable, and consequently the bin directory wasn't being added correctly to the path.  Anyway, thanks again!  You're too nice!!!
~DPD