1

After days of debugging my Windows Mobile application I have came to a conclusion that the error I get is simply caused by std::list code which I have added.

Just after adding this small piece of code :

std::list<int> x;
x.push_back(234);

My application crushes.

Therefore my question arises : Which of the STL's containers can be used in Windows Mobile and which cannot ?

I have found this question but i do not find it useful for my problem.

Community
  • 1
  • 1
Patryk
  • 22,602
  • 44
  • 128
  • 244

1 Answers1

2

If your program compiles and links fine, there shouldn't be anything missing or crashing (for removed or unsupported stuff you should expect a compiler error (e.g. "unknown variable/function/whater" or some kind of preprocessor warning/error). It's more likely there's some other screw up in your code. Have you tried to reproduce the issue using a minimal program?

Mario
  • 35,726
  • 5
  • 62
  • 78
  • The only thing I have checked is that as soon as I add some code with STL container, my program still compiles but I get a PInvoke error - as my C++ dll library is linked to my C# Windows Mobile application. – Patryk Jan 15 '12 at 23:01
  • Ew! That might be the reason. You're probably trying to mix and match STL stuff from debug and release builds or similar things. Are you somehow trying to use or link older/newer code (e.g. VS2010 + VS2008)? – Mario Jan 15 '12 at 23:21
  • What do you mean by this? I have one solution and projects included in my VS2008 solution. [Something like this](http://img641.imageshack.us/img641/9162/mobile1.png) – Patryk Jan 15 '12 at 23:31
  • so the C# DLL no longer is able to call the C++ method? What is the method signature? – ctacke Jan 16 '12 at 01:55
  • @ctacke `extern "C" int __declspec(dllexport) processImage(const char* in_file, const char * out_file);` This is what you wanted to know ? And then in C# code : `[DllImport("DLL.dll", EntryPoint = "processImage")]` `private static extern int _ProcessImage(byte[] in_file, byte[] out_file);` – Patryk Jan 16 '12 at 02:09
  • Think that looks fine. The error is most likely somewhere in your C++ code (possibly some buffer overrun or whatever). – Mario Jan 16 '12 at 09:13
  • @Mario As I have said : Everything is just fine until I add code from `std::list` or other STL container. Maybe there is some memory allocation issue on Windows Mobile ? – Patryk Jan 16 '12 at 13:57
  • I'm not really sure on this. Maybe it's something happening somewhere else. In general, I wouldn't expect this to be a bug they haven't found (as it would be too obvious). Have you tried a minimal example? Like just creating a list in your native code, without doing anything else? – Mario Jan 18 '12 at 10:54