Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

xml and fortran

fernando_gmu
Beginner
967 Views

I have to parse xml files from FORTRAN. I have developed a C++ library that uses visual studio XML libraries.

If I call the subroutine that opens and reads the XML file from a C executable everything works fine. Now, if I do the same from a FORTRAN executable doesnt work. It gives a forrtl error. I dont really understand what happens. I would appreciate any help in this issue. I upload the solution with the C++ library and the two executable projects.

Thanks

0 Kudos
6 Replies
Jugoslav_Dujic
Valued Contributor II
967 Views
The zip file you attached is empty; please re-upload.

Yoy may also be interested in this.
0 Kudos
fernando_gmu
Beginner
967 Views
Sorry, I have upload the zip file again. I will take a look to your sugestion. However, I will still like to know why the runtime error calling from fortran and not from c.

Thanks
0 Kudos
Jugoslav_Dujic
Valued Contributor II
967 Views
Having seen the code, I have a hunch that you get the crash because the static library uses CLR through #using , that Fortran (as well as myself) knows nothing about.

When I remove the references to namespace System and all that stuff (i.e. reducing the C++ code to bare bones without XML parser), the call is successfull (modulo the terminating � you forgot to append to filename, modulo the passed string length you didn't handle, but never mind). Even when I turn the winfgl into a DLL, the behavior is the same.

Offhand, it seems that there's no way for Fortran to ultimately call CLR anything; perhaps someone else might shed some more light on the subject.

P.S. 0xe0434f4d is a CLR exception indeed.
0 Kudos
fernando_gmu
Beginner
967 Views

Thanks for the link, good information.

It seems that I don't have too many options in this one.

Fernando

0 Kudos
Jugoslav_Dujic
Valued Contributor II
967 Views
For what it's worth, Xerces is also a widely used and free XML parser, and it's written in "plain vanilla" C++ (as opposed to CLR), so there shouldn't be any CLR problems even if you interact with Fortran. I used it myself on few occasions, albeit only from a pure C++ environemnt.
0 Kudos
fernando_gmu
Beginner
967 Views

Great tip. This make it for me. I willtry it.

Thanks,

Fernando

0 Kudos
Reply