|c# dll trouble
|Page 1 of 1|
|Author:||Pardus [ Mon Oct 22, 2007 2:16 pm ]|
|Post subject:||c# dll trouble|
I’m currently working on a project where I should write a dll that allows us to extract metadata from an MXF file. This dll should be accessed by an application written in c#.
I’ve written a wrapper around mxflib in c++ to retrieve the requested information and I’ve also provided a function that can be accessed from the c# application.
To test the library I’ve written a small application in c++ that calls this function and dumps the output to stdout. This application works as expected.
When I try to do the same from within c# I receive an error:
System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
I’ve traced it down ( it occurs in the ScanRIP() function) to the line
mxffile.h line 395
template<class TP, class T> /*inline*/ TP mxflib::MXFFile__ReadObjectBase(MXFFilePtr This, PrimerPtr UsePrimer /*=NULL*/)
UInt64 Location = This->Tell();
ULPtr Key = This->ReadKey();
// If we couldn't read the key then bug out
if(!Key) return Ret;
// Build the object (it may come back as an "unknown")
395: Ret = new T(Key);
Where T is a Partition. So it happens during the contruction of a Partition Object.
My code (simplified) is:
extern "C" __declspec(dllexport) _mxfdata Getmxfdata(char* filepath)
MXFFilePtr mxfFile = new MXFFile();
if (!mxfFile->Open(filepath, true))
error("Unable to open file\n");
Has anyone else tried the same?
Does someone have an idea on what could be the culprit of my problem?
|Author:||Pardus [ Mon Oct 22, 2007 3:19 pm ]|
I found the answer to my problem (took me the better part of a day to find it due to the clear error description ).
I retraced my steps an I found I forgot to copy the dict.xml file to my application directory.
My dll works like a charm now.
Thanks for providing us with this wonderfull library.
|Author:||gino [ Thu Jul 28, 2011 12:32 pm ]|
|Post subject:||Re: c# dll trouble|
Is it possible to receive your DLL and source code.
I want to do an MXF project but I don't know c++
|Page 1 of 1||All times are UTC|
|Powered by phpBB® Forum Software © phpBB Group