Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7850099
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T18:44:38+00:00 2026-06-02T18:44:38+00:00

Is there an alternative to using the following? class IGraphBuilder; public ref class Device

  • 0

Is there an alternative to using the following?

class IGraphBuilder;

public ref class Device
{
private:
    IGraphBuilder* pGraphBuilder;

public:
    void Configure()
    {
        pin_ptr<IGraphBuilder*> ppGraphBuilder = &pGraphBuilder;

        HRESULT hr = CoCreateInstance(CLSID_FilterGraph,
            NULL,
            CLSCTX_INPROC,
            IID_IGraphBuilder, (void**)ppGraphBuilder);

reinterpret_cast(ppGraphBuilder) compiles but I’m a bit confused if this is correct for this case.

If this wasn’t C++/CLI (where &NativeMember actually means interior_ptr<Type>(NativeMember)) I would simply use static_cast<void**>(&pGraphBuilder) but even after correctly casting to pin_ptr the following doesn’t compile

pin_ptr<IGraphBuilder*> ppGraphBuilder = &pGraphBuilder;
static_cast<void**>(ppGraphBuilder)

Is there any solution or am I forced to use (void**) because pin_ptr is weird?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T18:44:40+00:00Added an answer on June 2, 2026 at 6:44 pm

    reinterpret_cast (and thus C cast) is potentially not ok, although it may work due to the allegedly trivial layout of pin_ptr. Indeed you have to call the conversion operator from cli::pin_ptr<IGraphBuilder*> to IGraphBuilder** first (hence the complain from the compiler).

    reinterpret_cast<void**>(static_cast<IGraphBuilder**>(ppGraphBuilder))
    

    is correct. You may want to introduce a intermediary variable of type IGraphBuilder** first:

    pin_ptr<IGraphBuilder*> p = &pGraphBuilder;
    IGraphBuilder** ppGraphBuilder = p;
    
    HRESULT hr = CoCreateInstance(CLSID_FilterGraph,
            NULL,
            CLSCTX_INPROC,
            IID_IGraphBuilder, reinterpret_cast<void**>(p));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using a third party library class that has the following (abbreviated) method: public
Consider the following class: public class MyIntSet { private List<int> _list = new List<int>();
I have the following class: public class SqlCeEventStore: EventStore { private EventStoreDB db; public
I have the following C# code fragment: using System; class count { public static
Are there any pros/cons of using the following two alternatives in your action signature:
I use C#, MVVM, WPF and Resharper. When using the following code: public bool
Take the following class as an example: class Sometype { int someValue; public Sometype(int
I have the following situation: class A { public: A(int whichFoo); int foo1(); int
Consider the following simple code import java.util.*; public class MainTest<T extends Object1<?,?>> { List<T>
my application has the following entity: public class User { public virtual int UserID

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.