[ create a new paste ] login | about

Link: http://codepad.org/55pttk3I    [ raw code | fork ]

C++, pasted on Sep 3:
#include <stdio.h>
#include <string>

class FileName
{
public:
    FileName(const char *name) : m_name(name) { }
    std::string m_name;
};

extern "C"
FileName* ctor_FileName(char const *name)
{
    return new FileName(name);
}

extern "C"
FileName value_FileName(FileName* refVal)
{
    return *refVal;
}

int main()
{
    char const* filePath = "foo\0";
    void* cppObj = ctor_FileName(filePath);
    FileName fileName = value_FileName(reinterpret_cast<FileName*>(cppObj));
    
    printf("ok.\n");
    return 0;
}


Create a new paste based on this one


Comments: