B
Benek
Hello
I writing dll and application in C++, and I have a following problem:
In dll I have function:
void get_list(BYTE *&Buffer)
{
BYTE* Buf = new BYTE[5];
for(int i = 0; i < 5; ++i) {
Buffer = Buf; // Error
}
delete[] Buf;
}
Application use this function (from dll) like in following example:
...
List = new BYTE[5];
get_list(List);
delete[] List;
...
The problem is, that presented code doesn't work correctly.
When I run my application I've got an exception like: 'Access violation at
address 004604E3 in module 'Paluch.exe'. Write of address 00000005'.
Can you give me some hints? I have no idea what's wrong. If presented code
is located in one application (without dll) everything seems to be ok. How
can I resolve it?
Thank you
Pawel
I writing dll and application in C++, and I have a following problem:
In dll I have function:
void get_list(BYTE *&Buffer)
{
BYTE* Buf = new BYTE[5];
for(int i = 0; i < 5; ++i) {
Buffer = Buf; // Error
}
delete[] Buf;
}
Application use this function (from dll) like in following example:
...
List = new BYTE[5];
get_list(List);
delete[] List;
...
The problem is, that presented code doesn't work correctly.
When I run my application I've got an exception like: 'Access violation at
address 004604E3 in module 'Paluch.exe'. Write of address 00000005'.
Can you give me some hints? I have no idea what's wrong. If presented code
is located in one application (without dll) everything seems to be ok. How
can I resolve it?
Thank you
Pawel