---
layout: docs
title: codegenFunction
id: interface.Facebook.HackCodegen.ICodegenFactory.codegenFunction
docid: interface.Facebook.HackCodegen.ICodegenFactory.codegenFunction
permalink: /docs/reference/interface.Facebook.HackCodegen.ICodegenFactory.codegenFunction/
---
# Facebook\\HackCodegen\\ICodegenFactory::codegenFunction()




Create a top-level function (not a method)




``` Hack
public function codegenFunction(
  string $name,
): Facebook\HackCodegen\CodegenFunction;
```




## Parameters




+ ` string $name `




## Returns




* [` Facebook\HackCodegen\CodegenFunction `](<class.Facebook.HackCodegen.CodegenFunction.md>)