How to store lot of read-only data in DLL?-Collection of common programming errors
I need a way to store lot of numerical read-only data (double values) in a DLL. Data must be embedded in source, because it will be changed from time to time – no external tools like Visual Studio etc., only code generation+shell compiler.
I know that it is a bad practice, but this is “business requirement”.
I need to store about 2 000 000 of 32-bit float values. This should be about 8MB raw data. Assume that DLL size limit is 100MB. Language is Fortran.
My first thought was to generate value assignments to dynamic array:
work(1,1,1,1) = 826
work(1,1,1,2) = 935
work(1,1,1,3) = 712.5
work(1,1,1,4) = 617.1
work(1,1,1,5) = 102.2
But final source file has about 70 megabytes, and 0 chances to compile (compiler out of memory error). Besides, even if it would compile, final DLL have size of ~5MB for each 0.5MB of useful data.
Any ideas to format source in more compact way (compiler optimisation friendly?) or maybe pack data to other structure like string/raw binary data and extract on runtime ?