thegrinch
December 28th, 2006, 05:05 PM
Hi!
I am confused about the abnormal behaviour of my project.
Please consider the following situation:
I have written an application in C++.NET 2003 (managed) which loads and executes an unmanaged function from an unmanaged dll.
On the dll-side i export this function:
typedef struct {
int a;
int b;...} mystruct;
__declspec(dllexport) int dllfn(mystruct* x);
Ok.
This all compiles (and also executes, I can test this via logfiles, etc).
BUT:
If I assign values to the given struct, they "do not arrive" in the main (managed) application!!!
So, something like
x->a=17;
in the dll surprisingly does not set the value to 17 in the "real" struct allociated in the main application. On the other hand, the same instruction in the dll with
x->a=17;
printf("a: %ld", x->a);
Works!!!
I do not have any idea, why I apparently do not have access to the struct I want.
PLEASE HELP ME!
Thank you very much for your great help in advance!!!!
Kind regards!
thegrinch
I am confused about the abnormal behaviour of my project.
Please consider the following situation:
I have written an application in C++.NET 2003 (managed) which loads and executes an unmanaged function from an unmanaged dll.
On the dll-side i export this function:
typedef struct {
int a;
int b;...} mystruct;
__declspec(dllexport) int dllfn(mystruct* x);
Ok.
This all compiles (and also executes, I can test this via logfiles, etc).
BUT:
If I assign values to the given struct, they "do not arrive" in the main (managed) application!!!
So, something like
x->a=17;
in the dll surprisingly does not set the value to 17 in the "real" struct allociated in the main application. On the other hand, the same instruction in the dll with
x->a=17;
printf("a: %ld", x->a);
Works!!!
I do not have any idea, why I apparently do not have access to the struct I want.
PLEASE HELP ME!
Thank you very much for your great help in advance!!!!
Kind regards!
thegrinch