Open rizistt opened 2 months ago
Turns out it's not really a limitation of IKVM at all. I changed the MemoryStream
to FileStream
in the WriteResources
method and got this:
System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. (Parameter 'mappedFieldDataStreamRva')
at System.Reflection.Throw.ArgumentOutOfRange(String parameterName)
at System.Reflection.Metadata.Ecma335.MetadataRootBuilder.Serialize(BlobBuilder builder, Int32 methodBodyStreamRva, Int32 mappedFieldDataStreamRva)
Taking a deeper look, there's probably a hard limit of 3 or 2 GB for .NET assembly sizes as well, at least on Windows, as they are PE files, and ultimately loaded with LoadLibrary.
I don't have a workaround for you other than to not put this particular data in a JAR, etc.
Thank you for your response, @wasabii. As a workaround what I did was to modify the Jar itself and split it into 2 Jars and changed the metadata and got it working, I haven't fully tested it but it seems to be working. Unfortunately, I am not the author of those packages (yes it's more than 2 source packages and around 4 gigs in size) so I have very little control over what I can do with them.
As a feature, it might be useful to have the ability for ikvmc to generate assemblies with external resources as files or something.
It's actually a great idea.
Currently the method
WriteResources
underIKVM.Tools.Importer.CompilerClassLoader
usesMemoryStream
which is limited to 2 gigs in size whereas I'm working with JAR files (that contain CUDA dlls) having size greater than 2 gigs which causesIO_StreamTooLong
exception.Are there any workarounds?