add license headers and extern C