Skip to content

Duplicate SV structure typedefs are created when referenced by multiple Python APs #49

@cabajian

Description

@cabajian

When multiple Python APIs reference a structure type in their method arguments, the structure typedef is replicated in the generated SV package:

class Point(ct.Structure):
    _fields_ = [
        ("x", ct.c_int32),
        ("y", ct.c_int32),
    ]

@hif.api
class FirstAPI(object):
    @hif.imp
    async def func1(self, pt: Point):
        pass

@hif.api
class SecondAPI(object):
    @hif.exp
   def func2(self, pt: Point):
        print(pt)

The above code results in two Point_t structure typedefs in the generated SV package, resulting in the following VCS error:

Error-[IPD] Identifier previously declared
  Identifier 'Point_t' previously declared as typedef

A workaround is to split these APIs into separate files and generate them separately, but it would be convenient to add memory when a structure was generated to prevent duplicate definitions.

Metadata

Metadata

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions