Release mode and Debug mode

I am now using Visual C++ 6.0.

I got a program when I compile it as a exe file. It works fine in both Debug mode and Release mode. But without making any changes to the coding, when I complie it as a dll file.  It perform an illegal operations and hangs my machine...... in the release mode only but not in the debug mode.....

What's happen?

it is my program error or the complier have error?


Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

>> without making any changes to the coding,
>> when I complie it as a dll file.  It perform an
>> illegal operations and hangs my machine
How can the same code be both an EXE (with a main() or WinMain() function AND a DLL with a DllMain() function.) without changes?  You must be making changes.  what are you changing?

>> in the release mode only but not in the debug mode
Add debugging symboles to the release mode and run it under the debugger to try to determine where it is hanging.

>> it is my program error or the complier have error?
It could be ANYTHING.  There is no way we could tell you with the amount of information we have to work with.  It is likely to be but in your code, but we don't know anythig about it.
I believe, at a minimum, you'd have to add the /dll linker option so the entry becomes DllMain (as mentioned by Nietod) and then you'd obviously have to export DllMain.
Make sure to set warning level to 4.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Since you accepted my comment as an answer it must have helped...
Could you post what the problem turned out to be?
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.