E4219

E4219#

Compiler diagnostic name: invalid_export_name.

The #export_name attribute is invalid. Exported names must be unique valid C symbol identifiers, and the attribute may be used only on public, non-generic function definitions without optional arguments in a foreign-library package.

Erroneous example#

///|
#export_name("bad-name")
pub fn add_one(value : Int) -> Int {
  value + 1
}

Suggestion#

Use a valid symbol name and declare the package as a foreign library with pkgtype(kind: "foreign_library").

///|
#export_name("add_one")
pub fn add_one(value : Int) -> Int {
  value + 1
}