Hi everybody

I have a probleme with my console programe

So, I have a void in My DLL ,

void Mytest (LPCSTR files, int* erreur)
{
   .....
   ......
}

Now I Import this function in my console Programe

extern "C"  __declspec(dllimport) void Mytest (string files, int* erreur)

but when i test my program, it's give me this bug

Unhandled exception at 0x10002300 in FirstTest.exe: 0xC0000005: Access violation reading location 0xcccccc00.

can you help me plaise

Try using const char* instead of a string, since string is a class but LPCSTR is a character array.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.