read namelist from string broken?

read namelist from string broken?

I use Intel(R) Visual Fortran Composer XE 2011 Update 6 Integration for Microsoft Visual Studio* 2010, 12.1.3514.2010 and face a strange compiler/linker problem. The program below tries to parse an argument list from a string using a namelist but fails at linking with an unresolved symbol "_for_read_int_nml".

program namelisttest

	        character(len=255) :: buffer, str1, str2

	        namelist /arglist/ str1, str2

	        buffer = "&arglist str2='test string' /"



	end program


I tested this under linux (ifort and gfortran) without any problems. Is this a bug in the compiler, since it searches for _for_read_int_nml (instead of _for_read_seq_nml) ?

Is there a workaround (except writing a temporary file) or a better way for parsing a string into several fields?

Thanks in advance

7 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

I can't reproduce this with that (or any other) version - my guess is that your library path is incorrect somehow. Are you building from within Visual Studio or from the command line? Please show the build log (if using VS, attach a ZIP of buildlog.htm from the Debug or Release folder.) It would also be helpful if you enabled Linker > General > Show Progress > Display Some Progress Messages. From the command line, add /link /verbose:lib to the end of the ifort command line.

I would comment that NAMELIST is a rather strange approach for the task you describe.

Retired 12/31/2016

Hello Steve,

thanks for your response. I'll try to provide all the debug information you mentioned. However this has to wait a few hours for me being back in the office. In the meanwhile somewhat more "offline"-information: I'm building within Visual Studio. I tried this example with a new wizard-created project without any modifications and again on a colleague's computer (with a slightly more up-to-date version of Visual Fortran) - everywhere the same linkage error. Anyway ... let's come back to this after analyzing the debug information.

About your comment: using NAMELIST to parse an option character string without the hassle of tokenizing it the hard way seemed to be an elegant and quite portable (among different fortran compilers) way. However, any suggestions to reach this without "abusing" NAMELIST would be greatly appreciated.

If your option string was written using NAMELIST, then that's fine. I thought you were trying to use it for generic parsing.

Retired 12/31/2016

Well, some more results of my further explorations on this problem:

After checking all library paths and so on I still get the linkage error for all projects that use /libs:dll (and yes, it links successfully for /libs:static). And indeed, the symbol seems to be missing in my libifcoremd.dll (as far as dependency walker [] or is telling me). So, is this on purpose? Under linux ( the symbol is there, too.

Please see also the files of my test project and the build log in Debug, that I attached ...

Thanks again for your support.


Downloadapplication/zip namelist.zip4.62 KB

Thanks for the added detail, which was critical. This is NOT intentional - it's a bug. It is still broken in the current release. Amazing that this wasn't noticed before.  I will escalate this to development immediately. Issue ID is DPD200249837. All I can suggest for now is to link statically if you can.

Retired 12/31/2016

This will be fixed for Update 2, planned for January. It's something that got overlooked when we implemented NAMELIST internal I/O and you're the first to try that with DLL linking (though that becomes more likely with compiler version 14 as we now default to that in new projects.) We apologize for the inconvenience and thank you for bringing it to our attention.

Retired 12/31/2016

Leave a Comment

Please sign in to add a comment. Not a member? Join today