I faced a problem where the address of a structure (as a void pointer) is passed from one DLL 'A' to 'B'. Idea is that you store these void pointers to DLL 'B' and call them latter on the basis of some assigned keys. This structure contains data variables and some others functions/structure address too.
So, while fetching the address back from DLL 'B' rest of address pointed by the structure gets corrupted.
So, the questions arises are:
1) Shall we do a deep copy and pass structure instead of pointers.
2) Is passing pointers across DLL's is acceptable?
While looking for the solution I came across this interesting article from IBM. http://publib.boulder.ibm.com/infocenter/zvm/v5r3/index.jsp?topic=/com.ibm.zvm.v53.dmsa3/hdcode.htm.
Below are few highlights of this article:
1) A source file that contains a function call through a pointer that may point to either a function or function descriptor must be compiled as non-DLL code.
2) A source file that calls imported functions or imported variables by name must be compiled as DLL code.
3) A source file that contains a comparison of function pointers that may be DLL function pointers must be compiled as DLL code.
4) A source file that may pass a function pointer to DLL code through a parameter or a return value must be compiled as DLL code.
Wednesday, April 20, 2011
Monday, June 21, 2010
Try DLL'ze your Legacy code
DLL's are awesome, why to update your whole code for a simple change, just update DLL's. Get DLL's and get your build time down just like a squeezed lemon :) . But have you ever tried getting DLL's for the executable containing nearly 150 libraries and you are handling the legacy code running from last 20-25 years?
Making DLL's of smaller number of libraries are easier but the time consumption in the process of creation if you get into more and more libraries.
Common errors which you may face while creating the DLL:
1) While Linking: Unresolved symbols. To resolve check your link line, you probably have not included the required library.
2) Circular dependency tree: This is most annoying and requires a bit of hard work. Either the dll you are creating is itself is the dependency of a library (of a DLL) that you have included or that library depends on some other which interns depends to it.
3) Linking error, symbol already in libcpmt.dll (static) and msvcrt*.dll (dynamic) both. In such cases check your objects, some of them would have got build with MT flag. Convert them to MD and linking will get succeed.
Making DLL's of smaller number of libraries are easier but the time consumption in the process of creation if you get into more and more libraries.
Common errors which you may face while creating the DLL:
1) While Linking: Unresolved symbols. To resolve check your link line, you probably have not included the required library.
2) Circular dependency tree: This is most annoying and requires a bit of hard work. Either the dll you are creating is itself is the dependency of a library (of a DLL) that you have included or that library depends on some other which interns depends to it.
3) Linking error, symbol already in libcpmt.dll (static) and msvcrt*.dll (dynamic) both. In such cases check your objects, some of them would have got build with MT flag. Convert them to MD and linking will get succeed.
Wednesday, November 11, 2009
Saturday, May 23, 2009
Computer Virus: Sometimes are very Interesting
Just faced two virus issues and found them very interesting. Most of the anti-viruses were not able to remove them completely. I found these viruses inside my pen-drive.
First one is very common. Sometimes we tries to open the pen drive, it shows us different options to open it or says that the drive is not accessible. If we scan the pen drive with anti-virus, they mostly report it as uninfected. As far as I have learned these virus gets activated whenever we open the pen drive through ‘auto-play’. So first of all avoid using auto-play option. Now, open your pendrive through explorer, then got to tools -> folder option. Go to view tab and uncheck the ‘Hide protected operating system files. After this you will find a System.inf/Startup.inf (or some autorun file). Remove this file. Then eject your pen drive and insert it again. You would be now able to open the pen drive though double click or enter. :)
The second virus I dealt was creating an exe with a directory picture inside the parent directory. Since the exe was just as a directory in picture I clicked it many times which did nothing but executed that exe and made my computer slow. After unchecking the same check box as mentioned above I found new directories like System and New Folder. System folder contained a Driver.exe. I delete both these directories and found the problem solved.
First one is very common. Sometimes we tries to open the pen drive, it shows us different options to open it or says that the drive is not accessible. If we scan the pen drive with anti-virus, they mostly report it as uninfected. As far as I have learned these virus gets activated whenever we open the pen drive through ‘auto-play’. So first of all avoid using auto-play option. Now, open your pendrive through explorer, then got to tools -> folder option. Go to view tab and uncheck the ‘Hide protected operating system files. After this you will find a System.inf/Startup.inf (or some autorun file). Remove this file. Then eject your pen drive and insert it again. You would be now able to open the pen drive though double click or enter. :)
The second virus I dealt was creating an exe with a directory picture inside the parent directory. Since the exe was just as a directory in picture I clicked it many times which did nothing but executed that exe and made my computer slow. After unchecking the same check box as mentioned above I found new directories like System and New Folder. System folder contained a Driver.exe. I delete both these directories and found the problem solved.
Friday, October 3, 2008
Tuesday, September 30, 2008
Aaksa Beach, Mumbai
It was the second time in a year when I went Andheri, Mumbai to meet my friends. It hardly takes 4 hour by bus from Pune to reach there. I boarded the bus at 4:30pm Friday which took 1 1/2 hours to reach Mumbai-Pune highway only. It was a bad and a boring start.
I reached Andheri at 10:20pm. How can we expect to reach in time when we do have slow driving bus and unmoving traffic.
Next day we planned to visit Aaksa Beach at Malad which we heard in a song of movie 'God Tussi Great Ho'. I am sure many others would have already visited this beach soon after hearing this song.
At 5pm Saturday we hired AutoRikshaw from Inorbit (Shooping Mall), Malad for the Aksa beach which took nearly 25 minutes to reach there. Aksa is far from the crowd of the city. It is quite clean and wasn't packed by the visitors. Either this was the reason or we have become more responsible towards cleaning. Both of these are partially correct.
We were surprised to see the rates of food stuff in the shops at beach. Its was just approximate to MRP :), whereas in Railway Platform you will get the things nearly 5Rs more to the MRP.
It was the first time when I saw a beach. You can fell the difference in the blowing air and noise made by the waves. These noise instead of creating a havoc at your mind bring peace to it. But as the noise will grow you will scare as it means that big waves are on their way. So, don't let the nature go angry but respect it.
We played and enjoyed there till the sun set. The reflection of Sun on the sea was sparkling. Watching a sunset is always beautiful and watching it setting behind the sea brings natures one of the best gift to humans.
For returning back to Andheri we hired the auto to reach Malad railway station and then boarded local train for Andheri.
Its always a fun to visit there and yet again my trip to Mumbai was fruitful.
Subscribe to:
Posts (Atom)