# Why exported task or function can't have open arrays as a formal argument whereas imported function or task have?

**URL:** <https://verificationacademy.com/forums/t/why-exported-task-or-function-cant-have-open-arrays-as-a-formal-argument-whereas-imported-function-or-task-have/38425>\
**Category:** SystemVerilog\
**Tags:** SystemVerilog, DPI, systemverilog-Arrays-packedarrays-unpackedarrays, export-DPI-C, DPI-C-import-with-dynamic-array-as-argument\
**Created:** [December 3, 2020, 10:28am UTC](https://verificationacademy.com/forums/t/why-exported-task-or-function-cant-have-open-arrays-as-a-formal-argument-whereas-imported-function-or-task-have/38425 "2020-12-03T10:28:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![skushwah](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/s/48db29/32.png) [@skushwah](https://verificationacademy.com/forums/u/skushwah)\
**Post date:** [December 3, 2020, 10:28am UTC](https://verificationacademy.com/forums/t/why-exported-task-or-function-cant-have-open-arrays-as-a-formal-argument-whereas-imported-function-or-task-have/38425/1 "2020-12-03T10:28:54Z")

</div>

This question is based on DPI.  
Please provide me the reason behind above scenario.

Thanks & Regards  
Shivakant

---

<div class="post-metadata">

**Author:** ![dave\_59](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/dave_59/32/4499_2.png) [@dave\_59](https://verificationacademy.com/forums/u/dave_59)\
**Post date:** [December 4, 2020, 7:53pm UTC](https://verificationacademy.com/forums/t/why-exported-task-or-function-cant-have-open-arrays-as-a-formal-argument-whereas-imported-function-or-task-have/38425/2 "2020-12-04T19:53:35Z")

</div>

_In reply to [skushwah](https://verificationacademy.com/forums/t/why-exported-task-or-function-cant-have-open-arrays-as-a-formal-argument-whereas-imported-function-or-task-have/38425):_

The problem is that C has no concept of open array sizes; you just have a pointer to the first element and it’s up to you to know by some other mechanism how big the array is. It’s easy to go from SystemVerilog to C, but the DPI does not provide an API from C to tell SystemVerilog how much memory the array takes up.

---

<div class="post-metadata">

**Author:** ![skushwah](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/s/48db29/32.png) [@skushwah](https://verificationacademy.com/forums/u/skushwah)\
**Post date:** [December 7, 2020, 2:33am UTC](https://verificationacademy.com/forums/t/why-exported-task-or-function-cant-have-open-arrays-as-a-formal-argument-whereas-imported-function-or-task-have/38425/3 "2020-12-07T02:33:31Z")

</div>

_In reply to [dave\_59](https://verificationacademy.com/forums/t/why-exported-task-or-function-cant-have-open-arrays-as-a-formal-argument-whereas-imported-function-or-task-have/38425/2):_

Thanks Dave
