RtlFreeHeap Problem in dll
-
Hi! I have a problem with dll programming. I am programming dll's for the micorosft flightsimulator. Anyway in DEBUG mode i have the strange problem that i get a assertion in ntdll.dll telling me that a incorrect adress is passed to RtlFreeHeap when the sim wants to unload my module...so the problem is only on closing my dll. The error occours in the fs9.exe and not in my dll but i pass many (correct) pointers to the exe of course and its working with them. I had found that the invalid adress that is passed to the RtlFreeHeap function is a pointer to a constant character string "xxxxxx" located in the .rdata section of my dll. When i remove the constant for my code the problem is still present but points to antoher adress also somewhere in the .rdata area of my dll. Has anybody a idea what could be wrong with my heap setup and/or dll compilation that causes a problem with my .rdata memory area. Is there maybe something that i do not know about constants in dll's or resources in dlls. My dll needs much memory, but still in the minimal configuration the error is present. Again the problem is only on closing where the fs9.exe wants to free my memory? ans is not present during normal operation. Additional i could find that error when compiling in release mode. Is there somewhere a tutorial about "do nots" in dll code programming... hope somebody can help me regards Florian
-
Hi! I have a problem with dll programming. I am programming dll's for the micorosft flightsimulator. Anyway in DEBUG mode i have the strange problem that i get a assertion in ntdll.dll telling me that a incorrect adress is passed to RtlFreeHeap when the sim wants to unload my module...so the problem is only on closing my dll. The error occours in the fs9.exe and not in my dll but i pass many (correct) pointers to the exe of course and its working with them. I had found that the invalid adress that is passed to the RtlFreeHeap function is a pointer to a constant character string "xxxxxx" located in the .rdata section of my dll. When i remove the constant for my code the problem is still present but points to antoher adress also somewhere in the .rdata area of my dll. Has anybody a idea what could be wrong with my heap setup and/or dll compilation that causes a problem with my .rdata memory area. Is there maybe something that i do not know about constants in dll's or resources in dlls. My dll needs much memory, but still in the minimal configuration the error is present. Again the problem is only on closing where the fs9.exe wants to free my memory? ans is not present during normal operation. Additional i could find that error when compiling in release mode. Is there somewhere a tutorial about "do nots" in dll code programming... hope somebody can help me regards Florian
Don't know much details about FS, as I never program anything for that, and I just hope this will not be complete OT ;-) My rule for dll programming is: Do not release memory allocated in another module. This means if you allocate something in your dll (eg the malloc/new is called inside your library) the corresponding free/delete should be called also in your code inside the same library. Maybe you have some situation when you passed something you allocate to the fs9.exe and it tries to release it for whatever reason or vice versa - you're releasing something allocated in fs9.exe or another module.
-
Don't know much details about FS, as I never program anything for that, and I just hope this will not be complete OT ;-) My rule for dll programming is: Do not release memory allocated in another module. This means if you allocate something in your dll (eg the malloc/new is called inside your library) the corresponding free/delete should be called also in your code inside the same library. Maybe you have some situation when you passed something you allocate to the fs9.exe and it tries to release it for whatever reason or vice versa - you're releasing something allocated in fs9.exe or another module.
Hi! Everthing solved and cleared, i have changed a char* of the exe instead of copying my string to this pointer...so when the exe tries to clean up its char* it pointed to a constant memory location of my dll and so causes a conflict... thank you anyway florian