Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: exception mixing VCL and DLL in c++11


This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 0
Martin Stratmann

Posts: 18
Registered: 5/26/00
exception mixing VCL and DLL in c++11  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Apr 2, 2017 6:49 AM
I get an exception when I mixing VCL and DLL in CLang-Compiler bcc32c in RAD Studio Tokyo 10.2

On my MainForm::ButtonClick I do the following:
//---------------------------------------------------------------------------
void __fastcall TForm1::ButtonClick(TObject *Sender)
	{
	std::vector<int> v;
	dll_vector(v);
        // ...
        }


In my DLL, I do the following:
#include <vector>
//---------------------------------------------------------------------------
extern "C" int _libmain(unsigned long reason)
	{
	return 1;
	}
//---------------------------------------------------------------------------
void __export dll_vector(std::vector<int>& v)
	{
	v.push_back(1);
	}


The second click on Button throws the exception:
$C0000005 'access violation at 0x50039f41: write of address 0x00000001'. Prozess cpp11.exe (9204)

The last stack trace is
void deallocate(pointer _Ptr, size_type _Count)
{	// deallocate object at _Ptr
	_Deallocate(_Ptr, _Count);
}

in xmemory0

In my DLL-Project, I've include the library usebormm.lib from RAD Studio \lib\win32c\debug\usebormm.lib

Is it not impossible to mix VCL with DLL in bcc32c-Compiler?

Regards,
Martin

Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02