# How to connect DPI systemverilog to class member

**URL:** <https://verificationacademy.com/forums/t/how-to-connect-dpi-systemverilog-to-class-member/39816>\
**Category:** UVM\
**Tags:** UVM, DPI\
**Created:** [November 15, 2021, 12:35pm UTC](https://verificationacademy.com/forums/t/how-to-connect-dpi-systemverilog-to-class-member/39816 "2021-11-15T12:35:31Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![TomerMetz](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/t/bbe5ce/32.png) [@TomerMetz](https://verificationacademy.com/forums/u/TomerMetz)\
**Post date:** [November 15, 2021, 2:55pm UTC](https://verificationacademy.com/forums/t/how-to-connect-dpi-systemverilog-to-class-member/39816/3 "2021-11-15T14:55:31Z")

</div>

_In reply to [cgales](https://verificationacademy.com/forums/t/how-to-connect-dpi-systemverilog-to-class-member/39816/2):_

> _In reply to [eranv](https://verificationacademy.com/forums/t/how-to-connect-dpi-systemverilog-to-class-member/39816/2):_  
> It’s not clear what you want to achieve, but the DPI C layer has the concept of ‘context’ so that the C code can determine which SV component is doing the calling. You can also set the ‘context’ on the C side so you can target a specific SV component.  
> Annex H section H.9 of the LRM discusses this implementation.

Hi,  
If I understand the problem correctly, he’s looking for a way to instantiate a c++ object that would be accessible via the DPI functions but would be instantiated outside the scope of these functions.

Eran - is this what you’re trying to achieve?

---

_[View the full topic](https://verificationacademy.com/forums/t/how-to-connect-dpi-systemverilog-to-class-member/39816)._
