As for your B array, I'm guessing it was defined in the program file that's using this library. Unfortunately, your library can't "see" any variables that were defined outside of it. Either you must pass B into INIT as an argument and work with it there, or you must define B in your library and set up COMMON functions that allow other files to access it.