I am using CodeGear RAD Studio Borland Builder C++. I have a dll file that I have linked implicitly. I want to be able to use the classes and functions inside this library, but everytime I try, I get a first chance exception at run time stating, "Exception class EAccessViolation with message 'Access violation at address 0040224E in module...'".
I have tried linking explicitly with the same outcome.
Here is the code from my .cpp file.
And here is some of the virtual code from the dll.
Does anyone have any idea why I am getting this exception? Do you think it would be better to link explicitly?
I have tried linking explicitly with the same outcome.
Here is the code from my .cpp file.
Code:
void __fastcall TForm1::Button1Click(TObject *Sender)
{
TMainIFace *nitf;
TTextIFace *text = nitf->AddText();
char szbuf[] = "my nitf text block";
text->AddData(szbuf, strlen(szbuf));
nitf->Write("test_nitf.ntf");
delete nitf;
}
And here is some of the virtual code from the dll.
Code:
class TTextIFace : public TBaseObjectIFace
{
public:
virtual TTextIFace& operator=(const TTextIFace& seg) = 0;
virtual TTextHeaderIFace* const Header() = 0;
virtual const char* Data() = 0;
virtual unsigned int DataSize() = 0;
virtual unsigned int Size() = 0;
virtual void Delete() = 0;
[COLOR=red]virtual void AddData(const char* AData, unsigned int ASize) = 0; [/color]
//user associated data can go here
virtual void SetObject(void *AObj) = 0;
virtual void* GetObject() = 0;
};
class TMainIFace : public TBaseObjectIFace
{
public:
virtual ~TMainIFace() { };
virtual TMainIFace& operator=(const TMainIFace& seg) = 0;
virtual TImageIFace* const AddImage() = 0;
[COLOR=red] virtual TTextIFace* const AddText() = 0; [/color]
virtual TSymbolIFace* const AddSymbol() = 0;
virtual TLabelIFace* const AddLabel() = 0;
virtual TDESIFace* const AddDES() = 0;
virtual TRESIFace* const AddRES() = 0;
virtual TMainHeaderIFace* const Header() const = 0;
[COLOR=red]virtual int Write(const char* AFilename) = 0;[/color]
virtual unsigned int Size() = 0;
//contains other functions not shown
};
Does anyone have any idea why I am getting this exception? Do you think it would be better to link explicitly?