what the?

Started by
7 comments, last by sQuid 20 years, 8 months ago
Can anyone give me a remotely plausible reason as to why this might happen? I have two functions in a dll called Tangle(Matrix) and ITangle(Matrix,int) which both return doubles. If I call either of them in an example program they work fine. If I call one after the other (in either order) or even call the same function twice I get an "example.exe has encountered a problem and needs to close" error dialog. The details list the module name as ntdll.dll Even more bizarrely if I add a line above the return statement in each function like so ... std::cout << tangle*tangle; return tangle*tangle; } Then I no longer get the error dialog and everything works fine. Am I going mad?
Advertisement
code?
The entire code is here if you're interested.

This is VC++ 7. The same code works with g++ 3.2.1

I hate porting.

[edited by - sQuid on August 12, 2003 8:08:38 PM]
std::cout << ret*ret;
return ret*ret;

my guess its the assembly code between these 2 some how.
try making another double to return and set it equal to ret*ret?
This sounds like a threading problem

Go to project->settings->c/c++ tab->change catagory to ''code generation'', and set the run-time library type to "debug multi-threaded", or try "debug multi-threaded dll"

One of these options should work.. This has remedied similar problems like this for me in the past.

-=|Mr.Oreo|=-
Code Monkey, Serpent Engine
-=|Mr.Oreo|=-Code Monkey, Serpent Engine
Thanks, it was a threading / debug thing and I never would have thought of that.

/MLd for compiling the example and /LDd for the dll seems to work.

[edited by - sQuid on August 12, 2003 8:49:31 PM]
*sigh*

Now it just dies on the 5th attempt at calling either of the two functions. Which, although better than dying on the 2nd attempt, is still completetly weird.
Yeesh. So if I also add the /MDd switch when I am *compiling* the DLL as opposed to just the /LDd switch when linking it everything is fine.

Oh what fun. I''m sure you''re all fascinated.
Well yeah, it either uses a thread-safe version of the C runtime library or it doesn''t. Use the wrong one and you''re toast.
--God has paid us the intolerable compliment of loving us, in the deepest, most tragic, most inexorable sense.- C.S. Lewis

This topic is closed to new replies.

Advertisement