Kevin Howe said:
> http://tidy.sourceforge.net/docs/api/group__Save.html#a3
> int tidySaveString(TidyDoc tdoc, tmbstr buffer, uint * buflen)

Try the following code, since 'tmbstr' in tidy header files is
considered as 'char *' or 'const char *'.

-- test.rb --
require 'dl/import'

module Tidylib
  extend DL::Importable

  dlload "libtidy.so"

  extern "void *tidyCreate()"
  extern "int tidyParseString(void*,char*)"
  extern "int tidySaveString(void*, char*, int ref)"

  module_function

  def create()
    tidyCreate()
  end

  def parse_string(doc, str)
    tidyParseString(doc, str)
  end

  def save_string(doc, out)
    tidySaveString(doc, out, out.size)
    return @args[2]
  end
end

out = "                          "
doc = Tidylib.create()
Tidylib.parse_string(doc, <<EOS)
<html>
</html>
EOS
p Tidylib.save_string(doc, out)

-- 
Takaaki Tateishi <ttate / ttsky.net>