Question about vfprintf hook VM argument
thomas.stuefe at gmail.com
Mon May 8 09:29:28 UTC 2017
what exactly is the purpose of the FILE* argument in the vfprintf hook?
We had - actually several times already - the problem that our VM was
embedded by a customized launcher which used the vfprintf hook to redirect
the VM output. If the launcher uses the FILE* handed over by the VM to
write to, it must be linked against the same C-Runtime as the VM itself.
This is not necessarily a given, especially on Windows: the launcher may
link against the debug C-Runtime (compiled with /MDd) wheras the JDK is
build with "/MD" and links against the release C-Runtime. Or the launcher
may even have been linked statically against the C-Runtime. Or...
In my opinion it is not a good idea to hand over C-Runtime internals - be
it malloced memory or FILE* pointers - to other binaries which may have
been built with different build options. But I do not even understand the
point of passing FILE* to the hook? If the point of the hook is to give
embedding code the ability to write to somewhere else, why even bother
giving it *my* file pointer?
Thanks & Kind Regards, Thomas
More information about the hotspot-dev