I wrote my dll in win32asm using MASM32. It works fine until it is called from within applications written in win32asm. As soon as I call some functions from a Borland C++ Builder project some pointers to DDraw objects seem to be altered, and the application gets a memory violation error. Any idea ? How can I defend my dll from being attacked by C++ Builder applications ? Thanks in advance, and visit my pages for programmers at: www.hochfeiler.it/alvise This message was edited by Alvise, on 1/25/2001 10:15:37 AM
All versions of BCB have a COM problem that kicks in a specific case (I think it's when you use a BCB app to connect to a COM server) that issue 1 AddRef to many. The problem is the use of a 'smartpointer' in the VCL class files instead of the regular MS issued variant pointer. This might be the problem and if it is: then there is no solution, since the solution would be to call release on the COM object yourself only when the caller is a BCB app.(which you can't possibly know) Anyway it's always a large discussion, search on newsforums for COM bug in BCB and you'll find it. It's a very long and difficult issue and it's been long since I read up on it (having BCB4 PRO :() so I only remember a tiny essence of it (which might not even be entirely correct anymore *the pointer part is correct*), so please forgive if me this info is partially incorrect. I hope that this is not the problem you face. -H- This message was edited by Hiroshimator, on 1/25/2001 11:11:19 AM
You are right, it is a *pointer* problem. Although difficult to debug I traced that the Instruction Pointer, at the time the violation occurs, points to the instruction that moves the address of the COM object into EAX, but the reference is invalid, and the violation occurs. I thaught to save a copy of the reference to the COM object and use it instead: this time it seems that the reference is valid, and EAX is loaded properly, but it seems also that the COM object has moved from there. Infact as soon as I call it I get another violation. I don't think I am using a COM server. If you want to have a look at the code that I am dealing with please follow this link: www.hochfeiler.it/alvise/DDRAW.HTM In these days I am traslating the example provided in this link into a dll. That's all. Can you please give me the references to newsforums I can search in to find out something about my problem ? Many thanks in advance from Alvise.