Author Topic: CodeSnippets using nonstandard C++  (Read 6496 times)

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2875
CodeSnippets using nonstandard C++
« on: August 20, 2008, 01:05:29 am »
http://forums.codeblocks.org/index.php/topic,8595.msg64869.html#msg64869
Re: Multi File editing

Moved here from "Multi File editing" thread:

What part of CodeSnippets is nonstandard C++ ?

Maybe we can fix that if we knew what you mean.

DrewBoo said:

In memorymappedfile.cpp, you'll see that every function has separate Windows code and Linux code.  It follows this pattern:

Code
#ifdef __WXMSW__
  // (Code intended to build in Windows)
#else
  // (Code intended to build in Linux)
#endif


Since __WXMSW__ is not defined, my build blows up trying to build Linux-specific code.

Code
../memorymappedfile.cpp: In member function 'long int wxMemoryMappedFile::MapFile(const wxString&, bool)':
../memorymappedfile.cpp:107: error: 'open' was not declared in this scope
../memorymappedfile.cpp:124: error: 'MAP_FILE' was not declared in this scope

Thought #1:  Does wxWindows include a file operation API so we can outright eliminate this fragile code?

Thought #2:  I've read that MAP_FILE is legacy and is #defined as 0.  Can someone verify this? 

I don't know what this would break on other platforms, but I'm adding this code to the file and am trying a build now....

Code
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#ifndef MAP_FILE
     #define MAP_FILE 0
#endif
« Last Edit: August 20, 2008, 03:53:54 am by Pecan »

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2875
Re: CodeSnippets using nonstandard C++
« Reply #1 on: August 20, 2008, 01:07:05 am »
I've found a way around this.
CodeSnippets will no longer need the memory mapped file code.

I'll commit after I run the code for some days.
« Last Edit: August 20, 2008, 01:09:50 am by Pecan »

Offline DrewBoo

  • Multiple posting newcomer
  • *
  • Posts: 110
Re: CodeSnippets using nonstandard C++
« Reply #2 on: August 20, 2008, 05:49:25 pm »
I've found a way around this.
CodeSnippets will no longer need the memory mapped file code.

I'll commit after I run the code for some days.

Nice, Pecan.

Offline DrewBoo

  • Multiple posting newcomer
  • *
  • Posts: 110
Re: CodeSnippets using nonstandard C++
« Reply #3 on: August 23, 2008, 10:04:13 pm »
I've found a way around this.
CodeSnippets will no longer need the memory mapped file code.

I'll commit after I run the code for some days.

I saw the drop, Pecan.  Awesome.

I'll be able to test it Monday-ish.