    # File lib/sqlite3/driver/dl/driver.rb, line 152
        def create_function( db, name, args, text, cookie,
          func, step, final )
        # begin
          if @func_handler_callback.nil? && func
            @func_handler_callback = ::DL.callback( "0PIP" ) do |context,nargs,args|
              args = args.to_s(nargs*4).unpack("L*").map {|i| ::DL::PtrData.new(i)}
              data = API.sqlite3_user_data( context ).to_object
              data[:func].call( context, *args )
            end
          end

          if @step_handler_callback.nil? && step
            @step_handler_callback = ::DL.callback( "0PIP" ) do |context,nargs,args|
              args = args.to_s(nargs*4).unpack("L*").map {|i| ::DL::PtrData.new(i)}
              data = API.sqlite3_user_data( context ).to_object
              data[:step].call( context, *args )
            end
          end

          if @final_handler_callback.nil? && final
            @final_handler_callback = ::DL.callback( "0P" ) do |context|
              data = API.sqlite3_user_data( context ).to_object
              data[:final].call( context )
            end
          end

          data = { :cookie => cookie,
                   :name => name,
                   :func => func,
                   :step => step,
                   :final => final }

          API.sqlite3_create_function( db, name, args, text, data,
            ( func ? @func_handler_callback : nil ),
            ( step ? @step_handler_callback : nil ),
            ( final ? @final_handler_callback : nil ) )
        end