/// <summary>
        /// Get the native library symbols and map them to the appropriate functions/delegates.
        /// </summary>
        private void Initialize()
        {
            string symbolMappingError = "Delegate of an exported function couldn't be created for symbol '{0}'";

            this.gsapi_revision = _library.GetDelegateForFunction <gsapi_revision>("gsapi_revision");

            if (this.gsapi_revision == null)
            {
                throw new GhostscriptException(string.Format(symbolMappingError, "gsapi_revision"));
            }

            gsapi_revision_s rev = new gsapi_revision_s();

            if (this.gsapi_revision(ref rev, System.Runtime.InteropServices.Marshal.SizeOf(rev)) == 0)
            {
                _revision = rev.revision;
            }

            this.gsapi_new_instance = _library.GetDelegateForFunction <gsapi_new_instance>("gsapi_new_instance");

            if (this.gsapi_new_instance == null)
            {
                throw new GhostscriptException(string.Format(symbolMappingError, "gsapi_new_instance"));
            }

            this.gsapi_delete_instance = _library.GetDelegateForFunction <gsapi_delete_instance>("gsapi_delete_instance");

            if (this.gsapi_delete_instance == null)
            {
                throw new GhostscriptException(string.Format(symbolMappingError, "gsapi_delete_instance"));
            }

            this.gsapi_set_stdio = _library.GetDelegateForFunction <gsapi_set_stdio>("gsapi_set_stdio");

            if (this.gsapi_set_stdio == null)
            {
                throw new GhostscriptException(string.Format(symbolMappingError, "gsapi_set_stdio"));
            }

            this.gsapi_set_poll = _library.GetDelegateForFunction <gsapi_set_poll>("gsapi_set_poll");

            if (this.gsapi_set_poll == null)
            {
                throw new GhostscriptException(string.Format(symbolMappingError, "gsapi_set_poll"));
            }

            this.gsapi_set_display_callback = _library.GetDelegateForFunction <gsapi_set_display_callback>("gsapi_set_display_callback");

            if (this.gsapi_set_display_callback == null)
            {
                throw new GhostscriptException(string.Format(symbolMappingError, "gsapi_set_display_callback"));
            }

            if (is_gsapi_set_arg_encoding_supported)
            {
                this.gsapi_set_arg_encoding = _library.GetDelegateForFunction <gsapi_set_arg_encoding>("gsapi_set_arg_encoding");

                if (this.gsapi_set_arg_encoding == null)
                {
                    throw new GhostscriptException(string.Format(symbolMappingError, "gsapi_set_arg_encoding"));
                }
            }

            this.gsapi_init_with_args = _library.GetDelegateForFunction <gsapi_init_with_args>("gsapi_init_with_args");

            if (this.gsapi_init_with_args == null)
            {
                throw new GhostscriptException(string.Format(symbolMappingError, "gsapi_init_with_args"));
            }

            this.gsapi_run_string_begin = _library.GetDelegateForFunction <gsapi_run_string_begin>("gsapi_run_string_begin");

            if (this.gsapi_run_string_begin == null)
            {
                throw new GhostscriptException(string.Format(symbolMappingError, "gsapi_run_string_begin"));
            }

            this.gsapi_run_string_continue = _library.GetDelegateForFunction <gsapi_run_string_continue>("gsapi_run_string_continue");

            if (this.gsapi_run_string_continue == null)
            {
                throw new GhostscriptException(string.Format(symbolMappingError, "gsapi_run_string_continue"));
            }

            this.gsapi_run_string_end = _library.GetDelegateForFunction <gsapi_run_string_end>("gsapi_run_string_end");

            if (this.gsapi_run_string_end == null)
            {
                throw new GhostscriptException(string.Format(symbolMappingError, "gsapi_run_string_end"));
            }

            this.gsapi_run_string_with_length = _library.GetDelegateForFunction <gsapi_run_string_with_length>("gsapi_run_string_with_length");

            if (this.gsapi_run_string_with_length == null)
            {
                throw new GhostscriptException(string.Format(symbolMappingError, "gsapi_run_string_with_length"));
            }

            this.gsapi_run_string = _library.GetDelegateForFunction <gsapi_run_string>("gsapi_run_string");

            if (this.gsapi_run_string == null)
            {
                throw new GhostscriptException(string.Format(symbolMappingError, "gsapi_run_string"));
            }

            this.gsapi_run_file = _library.GetDelegateForFunction <gsapi_run_file>("gsapi_run_file");

            if (this.gsapi_run_file == null)
            {
                throw new GhostscriptException(string.Format(symbolMappingError, "gsapi_run_file"));
            }

            this.gsapi_exit = _library.GetDelegateForFunction <gsapi_exit>("gsapi_exit");

            if (this.gsapi_exit == null)
            {
                throw new GhostscriptException(string.Format(symbolMappingError, "gsapi_exit"));
            }
        }
        /// <summary>
        /// Get the native library symbols and map them to the appropriate functions/delegates.
        /// </summary>
        private void Initialize()
        {
            string symbolMappingError = "Delegate of an exported function couldn't be created for symbol '{0}'";

            this.gsapi_revision = _library.GetDelegateForFunction<gsapi_revision>("gsapi_revision");
            
            if (this.gsapi_revision == null)
                throw new GhostscriptException(string.Format(symbolMappingError, "gsapi_revision"));

            gsapi_revision_s rev = new gsapi_revision_s();
            if (this.gsapi_revision(ref rev, System.Runtime.InteropServices.Marshal.SizeOf(rev)) == 0)
            {
                _revision = rev.revision;
            }

            this.gsapi_new_instance = _library.GetDelegateForFunction<gsapi_new_instance>("gsapi_new_instance");

            if (this.gsapi_new_instance == null)
                throw new GhostscriptException(string.Format(symbolMappingError, "gsapi_new_instance"));

            this.gsapi_delete_instance = _library.GetDelegateForFunction<gsapi_delete_instance>("gsapi_delete_instance");

            if (this.gsapi_delete_instance == null)
                throw new GhostscriptException(string.Format(symbolMappingError, "gsapi_delete_instance"));

            this.gsapi_set_stdio = _library.GetDelegateForFunction<gsapi_set_stdio>("gsapi_set_stdio");

            if (this.gsapi_set_stdio == null)
                throw new GhostscriptException(string.Format(symbolMappingError, "gsapi_set_stdio"));

            this.gsapi_set_poll = _library.GetDelegateForFunction<gsapi_set_poll>("gsapi_set_poll");

            if (this.gsapi_set_poll == null)
                throw new GhostscriptException(string.Format(symbolMappingError, "gsapi_set_poll"));

            this.gsapi_set_display_callback = _library.GetDelegateForFunction<gsapi_set_display_callback>("gsapi_set_display_callback");

            if (this.gsapi_set_display_callback == null)
                throw new GhostscriptException(string.Format(symbolMappingError, "gsapi_set_display_callback"));

            if (is_gsapi_set_arg_encoding_supported)
            {
                this.gsapi_set_arg_encoding = _library.GetDelegateForFunction<gsapi_set_arg_encoding>("gsapi_set_arg_encoding");

                if (this.gsapi_set_arg_encoding == null)
                    throw new GhostscriptException(string.Format(symbolMappingError, "gsapi_set_arg_encoding"));
            }

            this.gsapi_init_with_args = _library.GetDelegateForFunction<gsapi_init_with_args>("gsapi_init_with_args");

            if (this.gsapi_init_with_args == null)
                throw new GhostscriptException(string.Format(symbolMappingError, "gsapi_init_with_args"));

            this.gsapi_run_string_begin = _library.GetDelegateForFunction<gsapi_run_string_begin>("gsapi_run_string_begin");

            if (this.gsapi_run_string_begin == null)
                throw new GhostscriptException(string.Format(symbolMappingError, "gsapi_run_string_begin"));

            this.gsapi_run_string_continue = _library.GetDelegateForFunction<gsapi_run_string_continue>("gsapi_run_string_continue");

            if (this.gsapi_run_string_continue == null)
                throw new GhostscriptException(string.Format(symbolMappingError, "gsapi_run_string_continue"));

            this.gsapi_run_string_end = _library.GetDelegateForFunction< gsapi_run_string_end>("gsapi_run_string_end");

            if (this.gsapi_run_string_end == null)
                throw new GhostscriptException(string.Format(symbolMappingError, "gsapi_run_string_end"));

            this.gsapi_run_string_with_length = _library.GetDelegateForFunction<gsapi_run_string_with_length>("gsapi_run_string_with_length");

            if (this.gsapi_run_string_with_length == null)
                throw new GhostscriptException(string.Format(symbolMappingError, "gsapi_run_string_with_length"));

            this.gsapi_run_string = _library.GetDelegateForFunction<gsapi_run_string>("gsapi_run_string");

            if (this.gsapi_run_string == null)
                throw new GhostscriptException(string.Format(symbolMappingError, "gsapi_run_string"));

            this.gsapi_run_file = _library.GetDelegateForFunction<gsapi_run_file>("gsapi_run_file");

            if (this.gsapi_run_file == null)
                throw new GhostscriptException(string.Format(symbolMappingError, "gsapi_run_file"));

            this.gsapi_exit = _library.GetDelegateForFunction<gsapi_exit>("gsapi_exit");

            if (this.gsapi_exit == null)
                throw new GhostscriptException(string.Format(symbolMappingError, "gsapi_exit"));

        }