# Using coarrays in a shared library (OpenCoarrays)

**URL:** <https://fortran-lang.discourse.group/t/using-coarrays-in-a-shared-library-opencoarrays/1089>\
**Category:** Uncategorized\
**Created:** [April 22, 2021, 4:41am UTC](https://fortran-lang.discourse.group/t/using-coarrays-in-a-shared-library-opencoarrays/1089 "2021-04-22T04:41:08Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![themos](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/themos/32/521_2.png) [@themos](https://fortran-lang.discourse.group/u/themos)\
**Post date:** [April 22, 2021, 11:59am UTC](https://fortran-lang.discourse.group/t/using-coarrays-in-a-shared-library-opencoarrays/1089/3 "2021-04-22T11:59:10Z")

</div>

I would write a main program in Fortran that then calls a c\_main C routine. You can pass command line arguments in standard-conforming ways. On the C side, just rename your main() to c\_main() and recompile. At some point in the C code, you call a Fortran subroutine that uses coarrays. Compile and link with the Fortran compiler, deploy normally as for a Fortran coarray program. I tried an example with NAG Fortran Compiler.

---

_[View the full topic](https://fortran-lang.discourse.group/t/using-coarrays-in-a-shared-library-opencoarrays/1089)._
