llvm-mingw icon indicating copy to clipboard operation
llvm-mingw copied to clipboard

`fcloseall()` is missing (feature request)

Open top-master opened this issue 11 months ago • 6 comments

In case of error, my App closes and deletes all self-created files.

Now, although fcloseall is a GNU extension, I am/was able to use fcloseall with MSVC-2015.

Would it be possible to provide fcloseall in one of the llvm-mingw's .a files as well?

top-master avatar Mar 04 '24 06:03 top-master

fcloseall() isn't available, but _fcloseall() is available. Are you using the right name?

longnguyen2004 avatar Mar 04 '24 06:03 longnguyen2004

This isn't an issue specific to llvm-mingw, but to the mingw-w64 headers/libraries overall.

However, I do see that mingw-w64 headers do declare the function (both as fcloseall() and _fcloseall()), but only _fcloseall exists in the import libraries. I sent a patch at https://sourceforge.net/p/mingw-w64/mailman/message/58744420/ which should provide fcloseall as an alias to _fcloseall, just like we do for a number of similar functions.

mstorsjo avatar Mar 04 '24 08:03 mstorsjo

Thanks for fcloseall patch, feel free to close this ticket whenever it's merged or even now.

Also, the header seems to redirect from fcloseall to _fcloseall already, but the link-error was for "symbol _fcloseall", that with underscore.

However, I thought maybe name-mangling was adding the extra underscore, else I would mention _fcloseall in first-post.

top-master avatar Mar 04 '24 10:03 top-master

No, the header does no such redirection at the moment. On i686, all symbols have an extra underscore at the beginning.

mstorsjo avatar Mar 04 '24 10:03 mstorsjo

Okay, then the first-post was correct, because _fcloseall would be "symbol __fcloseall" in error-log, with two underscores. Can I call this change name-mangling?

top-master avatar Mar 04 '24 10:03 top-master

I guess it can be called name mangling, yes.

mstorsjo avatar Mar 04 '24 10:03 mstorsjo