Skip to content

Conversation

@rkanavath
Copy link
Contributor

To be merged after #357

g.list uses regex.h which is not available on MSVC.
This PR fixes g.list by using pcre library on windows
and use regex.h on other platforms.

This is Work in progress. Need to test the functionality of pcre v. regex

This is not a search and replace of __MING32__ with _WIN32.
There are places where __MINGW32__ is still used and all changes are
tested with MSVC 2019 compiler. Although, this commit alone will not work
on MSVC because there are plenty of other things to be done which are
seperated into multiple PR. PR OSGeo#289 is the one that "works" on MSVC and
unix as well. But that contains too many changes which shouldn't in a single
PR. Even though this PR alone won't compile GRASS GIS on MSVC, it sure will
not break existing compilers which I think is very important.

Complete support for MSVC will be ready after 2/3 PRs

OSGeo#289
static int initialized is not working for MSVC
and must export this with __declspec so that it appears in a DLL
correctly. This change has been tested on Ubuntu and MSVC 2019 and
is working as expected.
Below is a code from filldepr.cpp which throws error on msvc compiler
function has G_fatal_error() so it is 'normal' to have no return type.
But MSVC complains that function's return type is elevation_type*
and does not return anything.

elevation_type*
ext_fill_depression(AMI_STREAM<boundaryType> *boundaryStr,
			 cclabel_type maxWatersheds) {
  G_fatal_error(_("Fill_depressions do not fit in memory. Not implemented yet"));
}
The MSVC compiler only supports C90, it does not support C99
and variable length arrays are a feature of C99.
g.list uses regex.h which is not available on MSVC.
This PR fixes g.list by using pcre library on windows
and use regex.h on other platforms.

This is Work in progress. Need to test the functionality of pcre v. regex
@metzm
Copy link
Contributor

metzm commented Feb 24, 2020

The different PRs would add the same files, e.g. CMakeLists.txt in this PR and in #355, #354 and others. Please avoid the addition of the same files or identical changes in different PRs.

@rkanavath
Copy link
Contributor Author

@metzm, I don't know how to do that when splitting a big PR.
IF #357 is merged that I can rebase this current branch with master and will only have changes related to prce. But then it has to wait for other PR.

@wenzeslaus
Copy link
Member

I don't have a good suggestion on how to do it in this case because you need the CMake PR changes to make all the other things work. The only way I see is having the CMake changes in the source code uncommitted.

However, given the current state, it might be sufficient to resolve this only after the CMake PR is merged. The CMake support might not be finished, but the PR is close to something which could be merged.

@rkanavath rkanavath changed the title [WIP] fix g.list on msvc using pcre fix g.list on msvc using pcre Mar 2, 2020
@neteler neteler added enhancement New feature or request windows Microsoft Windows specific labels Dec 9, 2021
@neteler neteler added this to the 8.2.0 milestone Dec 9, 2021
@wenzeslaus wenzeslaus modified the milestones: 8.2.0, 8.4.0 Feb 27, 2022
@wenzeslaus wenzeslaus modified the milestones: 8.3.0, 8.4.0 Feb 10, 2023
@wenzeslaus wenzeslaus modified the milestones: 8.4.0, Future Apr 26, 2024
@wenzeslaus
Copy link
Member

Great. This work on pcre is part of #3621 now. So we can close this without loosing anything.

@wenzeslaus wenzeslaus closed this Feb 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request windows Microsoft Windows specific

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants