using c++ DLL with template class


I've recently tried to use an existing C++ library.. Now i was trying to test test the library but i


  • i think i have narrowed down the question:

    When using the function:
    std::string CTPGKIXOption3::MakeKIX(const std::string& strAddress, const std::string& strPostalCode)

    and i use REAL std::strings it all works fine. But when i use a String^ converted to a std::string it gives a debug error. the error states string Subscript out of range.

    the function used for conversion is:
    [code] void MarshalString( String ^ s, std::string& os ) {
    using namespace Runtime::InteropServices;
    const char* chars =
    (const char*)(Marshal::StringToHGlobalAnsi(s)).ToPointer();
    os = chars;
    What is going wrong in the conversion?

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


In this Discussion