Skip to content

Windows winmm - #931

Open
ourairquality wants to merge 2 commits into
rtklibexplorer:mainfrom
ourairquality:windows-winmm
Open

Windows winmm#931
ourairquality wants to merge 2 commits into
rtklibexplorer:mainfrom
ourairquality:windows-winmm

Conversation

@ourairquality

Copy link
Copy Markdown

Had a frustrating time with windows.h and trying to use ws2tcpip.h, and we will need this to modernise the stream code. windows.h appears be selectively depending on the headers that proceed it, and with it being included in rtklib.h that can become an issue that is hard to resolve. There is a 'lean' mode for windows.h that includes less and that resolves this, but that creates an issues for library winmm. The only function that is used from winmm is the tick timer, and there is a newer replacement, so suggest removing the dependence on winmm. Tested this PR building all the code with BCC, win app and console, and the qt code in visual studio cmake, all fine.

The import of CodeGear.Cpp generates a dup warning when building at
the command line.
tickget(): for Windows replace the use of timeGetTime() from library
winmm with GetTickCount64(). This might be a downgrade in accuracy but
there are other options if it is not good enough.

rtklib.h: define WIN32_LEAN_AND_MEAN before including windows.h. There
are ordering issues with windows.h and others include files such as
ws2tcpip.h, and having to include windows.h by way of rtklib.h in
every file that uses rtklib.h causes build trouble that is hard to
solve across all the build environments, and ws2tcpip.h will be needed
to modernise the stream code. winsock2.h is now only included in
stream.c.

winmm: remove from the build files.  winmm is legacy code.

msc: for the few console apps, link statically so these are more self
contained. e.g. so they run under wine without getting together all
the dependent DLLs.
@rtklibexplorer

Copy link
Copy Markdown
Owner

The changes to remove the winmm library looks good but I'm curious about the changes from MultiThreadedDebugDLL→MultiThreadedDebug and MultiThreadedDLL→MultiThreaded as well as removing CodeGear.Cpp from the .proj files. Are they required by the winmm changes or unrelated changes?

@ourairquality

Copy link
Copy Markdown
Author

Moving to have the MSC windows console apps compiled statically. This can make it easier for the to run under wine on linux. Have str2str compiling on MSC and using openssl and MSC supports statically linking the openssl libraries and that avoids having to bundle these for the console apps.

The CodeGear.Cpp appears to be a duplicate, was reported as such when compiling in the command line, and it seems to build without the duplicate.

@ourairquality

Copy link
Copy Markdown
Author

Btw still having a frustrating time with ws2tcpip.h on BCC - just can't avoid duplicate definition errors linking, but manage this by using it only in stream.c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants