473,387 Members | 1,721 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

mutex error when using C function in C++

Hi,

I'm using a C header and functions under a c++ class. The problem is
when I call the c func, say foo(...) directly under main there is no
problem, when I use it in the class VS debugger takes me to xmtx.c.

MyClass::executeFoo(...) {
foo(...);
}

int main(void) {
foo(...) //no problem
MyClass X;
X.executeFoo(); //problem
....
}
Thanks in advence.

Mar 15 '06 #1
6 5227
pm100 wrote:
Hi,

I'm using a C header and functions under a c++ class. The problem is
when I call the c func, say foo(...) directly under main there is no
problem, when I use it in the class VS debugger takes me to xmtx.c.

MyClass::executeFoo(...) {
foo(...);
}

int main(void) {
foo(...) //no problem
MyClass X;
X.executeFoo(); //problem
....
}

1. VS is unknown here.
2. Post the smallest *COMPILABLE* example that demonstrates the problem,
without requiring us to use any third party libraries.
Mar 15 '06 #2
pm100 wrote:
Hi,

I'm using a C header and functions under a c++ class. The problem is
when I call the c func, say foo(...) directly under main there is no
problem, when I use it in the class VS debugger takes me to xmtx.c.
What does "VS debugger takes me to xmtx.c" mean? What is xmtx.c? How does
the debugger take you there? What happens in your program instead of foo
being executed?
MyClass::executeFoo(...) {
foo(...);
}

int main(void) {
foo(...) //no problem
MyClass X;
X.executeFoo(); //problem
....
}


Well, from that code fragment and without knowing what actually happens, one
can only guess. Maybe your MyClass has a member function foo() that is
called instead of the global foo(), or foo() is in some namespace that
MyClass doesn't know about.

Mar 15 '06 #3
Smallest compilable code requires tons of dll and header files. xmtx.c
seems to be a mutex related file. I think the problem relates to
multithreaded/single threaded issue.

This is where debugger points in xmtx.c:

_RELIABILITY_CONTRACT
void __CLRCALL_PURE_OR_CDECL _Mtxlock(_Rmtx *_Mtx)
{ /* lock mutex */
#ifdef _M_CEE
System::Threading::Thread::BeginThreadAffinity();
#endif
EnterCriticalSection(_Mtx);
}

Also foo is in C style there is no namespace etc.
"VS debugger takes me to xmtx.c" means programs halts and visual studio
debugger tells where the last call happened.

Thanks again,

Mar 15 '06 #4
pm100 wrote:
Smallest compilable code requires tons of dll and header files. xmtx.c
seems to be a mutex related file. I think the problem relates to
multithreaded/single threaded issue.


Since standard C++ doesn't know anything of xmtx.c or threading, I
suggest you take this somewhere topical.

Ben Pope
--
I'm not just a number. To many, I'm known as a string...
Mar 15 '06 #5
Thanks I'll do that.

Mar 15 '06 #6
is source of foo() is available to you ? if yes make sure you link your
program to same version of C runtime as the foo() has been compiled.

e.g. Microsoft's Visual Studio comes with 6 diffrent version of C
runtime library!

Mar 16 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: toufik toufik | last post by:
I've the folowing error "Call to undefined function: phtmldec() " when using a script encrypted with PHTML Here are the steps done: - I've Appache (windows XP), PHP434 - using PHTML, I've...
1
by: H.L Bai | last post by:
hi, everybody i meet a parse error when i used the xml4c. any proposal is helpful. The error is following .../XMLRegionHandler.h:59 parse error before '*' .../XMLRegionHandler.h:60 parse...
1
by: Dermot O'Loughlin | last post by:
Can anyone help me with this? I get the following error when using the odbc adapter wizard in VS.Net 2003: --------------------------- Wizard Form --------------------------- An unexpected...
0
by: Charlie | last post by:
Hi: I get a TreeNode binding error when using Data property of XmlDataSource control. When I switch to TextFile property and point to xml file on hard drive, problem goes anyway. I'm...
0
by: =?Utf-8?B?TG93bGFuZGVy?= | last post by:
Hello, I've built a web application that uses client script callbacks. It is used on a large network with a large variety of user OSes and IE versions. It was tested on IE 6 on different setups...
2
by: desktop | last post by:
I get this error when I run my program: red_black_tree.cpp:188: error: no matching function for call to ‘std::less<MyObj<int::less(MyObj<int>&, MyObj<int>&)’...
2
by: sharmilah | last post by:
I have the following code in my script and it's giving a syntax error at line *** when using the password function. My password in the mysql database is encrypted using the password function itself...
8
by: msnews.microsoft.com | last post by:
Our IT team relocated our application servers yesterday. They had to take one machine out of the cluster because it would prompt users for credentials if accessed using the IP address, which I...
7
by: svsenthilkumar | last post by:
Hai, I got an javascript error when using ajax in mozilla browser, anyone help me why the error is coming, meaning for this error and how can i rectify this error. Error: " nsresult:...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.