I’ve got a problem with P/Invoke. I’m calling .dll (implemented on c++) from c# code. There is a class, that contains the next methods:
virtual AudioFileList *API CreateAudioFileList ()=0;
virtual bool API DisposeAudioFileList (AudioFileList *iAudioFileList)=0;
AudioFileList class looks like:
virtual bool API GetFile (long index, std::string *oPath, AudioFileInfo *fileInfo)=0;
virtual long API GetNumberFiles ()=0;
So, the question is how can I call CreateAudioFileList method and than pass the result to DisposeAudioFileList from C# code?
Thanks!
You can’t, due to name mangling. You should invest in learning C++/CLI. This will allow you to create an intermediary layer that provides proper marshaling and isn’t inhibited by name mangling in C++.
Here’s what it might look like in C++/CLI (untested, of course):
.h
.cpp