pin-ptr

pin_ptr performance relative to native (VC) heap objects

In a C# to native lib CLI/C++ wrapper, I have a choice: Store native pointer in a managed class (native object is created using native "new") or Store native object as a data blob in a managed class' field, and use pin_ptr to pin it before each native use. Has anyone done any comparative analysis on the relative performance costs...

how to put a pin_ptr into a generic list?

I've got a managed C++ method that takes as a parameter a list of String^ the method needs to populate an unmanaged structure with pointers to the memory in the String^ extracting the WCHAR* is simple enough with PtrToStringChars however I dont know the number of pin_ptr's to allocate at design time I'd like to add the pinned ptr to ...

Do I need a pin_ptr to pass a literal string?

Hello, From a managed c++ function I want to invoke an unmanaged function that expects a 'const char *' as an argument. Are a) and b) below correct? For b), do I need to pin_ptr 'hello'? What about a)? Thanks. a) myFunction( "hello" ); b) char hello[10] ; strcpy( hello, "hello" ); myFunction( hello ); ...

pin_ptr a native void* help

The Setup I have a PDF API which has a native function that is defined below. typdef void* PDF_DOCUMENT; unsigned long PDF_GetMetaText(PDF_DOCUMENT document, const char tag, void* buffer, unsigned long bufferlen) //Calling it "natively" in C++/...