What could cause an Invalid memory access error when calling a DLL function from Java