Changeset ffc3407d in OpenModelica


Ignore:
Timestamp:
2022-05-19T13:52:34+02:00 (2 years ago)
Author:
Mahder Gebremedhin <mahder.geb@…>
Children:
57178daf
Parents:
f0e38eb
git-author:
Mahder Gebremedhin <mahder.geb@…> (05/19/22 12:26:11)
git-committer:
Mahder Gebremedhin <mahder.geb@…> (05/19/22 13:52:34)
Message:

Define WIN32_LEAN_AND_MEAN to avoid mixup of winsock headers.

  • Define WIN32_LEAN_AND_MEAN on the compilation commands to avoid any chance of someone including windows.h without definning the macro and inadvertently including winsock.h which can not work with winsock2.h that we use in some places.
Location:
OMCompiler
Files:
20 edited

Legend:

Unmodified
Added
Removed
  • OMCompiler/Compiler/runtime/Dynload_omc.cpp

    ra0d552b rffc3407d  
    3333
    3434#if defined(_MSC_VER) || defined(__MINGW32__)
    35  #define WIN32_LEAN_AND_MEAN
    3635 #include <windows.h>
    3736#endif
  • OMCompiler/Compiler/runtime/Makefile.omdev.mingw

    rd77d5a5 rffc3407d  
    5151CC  = gcc
    5252CXX = g++
    53 override CFLAGS += $(USE_CORBA) $(USE_METIS) -Werror=implicit-function-declaration -Wall -Wno-unused-variable -I$(OMC_CONFIG_INC) -I$(top_builddir)/SimulationRuntime/c -I$(top_builddir)/SimulationRuntime/c/simulation/results -I$(top_builddir)/SimulationRuntime/c/util -I$(top_builddir)/SimulationRuntime/c/meta -I$(top_builddir)/SimulationRuntime/c/meta/gc $(CORBAINCL) $(GCINCLUDE) -I$(FMIINCLUDE) -I$(CJSONINCLUDE) -I$(GRAPHINCLUDE) -I$(LPSOLVEINCLUDE) -I$(SQLITE3INCLUDE) -I$(ZMQINCLUDE) -I"$(TOP_DIR)/3rdParty/FMIL/ThirdParty/Zlib/zlib-1.2.6" -I"$(TOP_DIR)/3rdParty/FMIL/build/zlib/" -I"$(TOP_DIR)/3rdParty/libffi/install/include/"
     53override CFLAGS += $(USE_CORBA) $(USE_METIS) -Werror=implicit-function-declaration -Wall -Wno-unused-variable -I$(OMC_CONFIG_INC) -I$(top_builddir)/SimulationRuntime/c -I$(top_builddir)/SimulationRuntime/c/simulation/results -I$(top_builddir)/SimulationRuntime/c/util -I$(top_builddir)/SimulationRuntime/c/meta -I$(top_builddir)/SimulationRuntime/c/meta/gc $(CORBAINCL) $(GCINCLUDE) -I$(FMIINCLUDE) -I$(CJSONINCLUDE) -I$(GRAPHINCLUDE) -I$(LPSOLVEINCLUDE) -I$(SQLITE3INCLUDE) -I$(ZMQINCLUDE) -I"$(TOP_DIR)/3rdParty/FMIL/ThirdParty/Zlib/zlib-1.2.6" -I"$(TOP_DIR)/3rdParty/FMIL/build/zlib/" -I"$(TOP_DIR)/3rdParty/libffi/install/include/" -DWIN32_LEAN_AND_MEAN
    5454override CXXFLAGS += -std=c++11 $(CFLAGS)
    5555
  • OMCompiler/Compiler/runtime/Print_omc.c

    ra0d552b rffc3407d  
    3030
    3131#if defined(_MSC_VER) || defined(__MINGW32__)
    32  #define WIN32_LEAN_AND_MEAN
    3332 #include <windows.h>
    3433#endif
  • OMCompiler/Compiler/runtime/Settings_omc.cpp

    ra0d552b rffc3407d  
    3232
    3333#if defined(_MSC_VER) || defined(__MINGW32__)
    34  #define WIN32_LEAN_AND_MEAN
    3534 #include <windows.h>
    3635#endif
  • OMCompiler/Compiler/runtime/SimulationResults_omc.c

    ra0d552b rffc3407d  
    3030
    3131#if defined(_MSC_VER) || defined(__MINGW32__)
    32  #define WIN32_LEAN_AND_MEAN
    3332 #include <windows.h>
    3433#endif
  • OMCompiler/Compiler/runtime/Socket_omc.c

    ra0d552b rffc3407d  
    2929 */
    3030
    31  #if defined(_MSC_VER) || defined(__MINGW32__)
    32  #define WIN32_LEAN_AND_MEAN
     31#if defined(_MSC_VER) || defined(__MINGW32__)
    3332 #include <windows.h>
    3433#endif
  • OMCompiler/Compiler/runtime/System_omc.c

    r6cbe437 rffc3407d  
    3030
    3131#if defined(_MSC_VER) || defined(__MINGW32__)
    32  #define WIN32_LEAN_AND_MEAN
    3332 #include <windows.h>
    3433#endif
  • OMCompiler/Compiler/runtime/ZeroMQ_omc.c

    ra0d552b rffc3407d  
    2929 */
    3030
    31  #if defined(_MSC_VER) || defined(__MINGW32__)
    32  #define WIN32_LEAN_AND_MEAN
     31#if defined(_MSC_VER) || defined(__MINGW32__)
    3332 #include <windows.h>
    3433#endif
  • OMCompiler/Compiler/runtime/omc_communication_impl.cpp

    r83be5f2b rffc3407d  
    3636// windows and mingw32
    3737#if defined(__MINGW32__) || defined(_MSC_VER)
    38 #define WIN32_LEAN_AND_MEAN
    3938#include <windows.h>
    4039
  • OMCompiler/Compiler/runtime/settingsimpl.c

    r81282189 rffc3407d  
    5252
    5353#if defined(_WIN32)
    54 #define WIN32_LEAN_AND_MEAN
    5554#include <windows.h>
    5655#endif
  • OMCompiler/Parser/Makefile.omdev.mingw

    r702aee8 rffc3407d  
    22CXX=g++
    33CFLAGS=-O3 -Wall
    4 CPPFLAGS=$(RMLINC) -I. -I$(ANTLR) -I$(ANTLR)/include $(BUILDINC) -I../3rdParty/gc/include
     4CPPFLAGS=$(RMLINC) -I. -I$(ANTLR) -I$(ANTLR)/include $(BUILDINC) -I../3rdParty/gc/include -DWIN32_LEAN_AND_MEAN
    55SHREXT=.dll
    66
  • OMCompiler/Parser/Parser_omc.c

    r98ded47 rffc3407d  
    3030
    3131#if defined(_MSC_VER) || defined(__MINGW32__)
    32  #define WIN32_LEAN_AND_MEAN
    3332 #include <windows.h>
    3433#endif
  • OMCompiler/SimulationRuntime/c/Makefile.common

    rf0e38eb rffc3407d  
    1616INCLUDE_NONFMI=-I. -I$(builddir_inc)/c
    1717
    18 CPPFLAGS = -I$(OMC_CONFIG_INC) -I$(top_builddir)/Compiler/runtime -I$(top_builddir)/3rdParty/gc/include -I$(top_builddir)/3rdParty/FMIL/install/include/ -I$(top_builddir)/3rdParty/lis-1.4.12/include/ -I$(builddir_inc)/sundials/ -I$(builddir_inc)/c/suitesparse/ $(CONFIG_CPPFLAGS) -DGC_REDIRECT_TO_LOCAL -DLINK_SUNDIALS_STATIC
     18CPPFLAGS = -I$(OMC_CONFIG_INC) -I$(top_builddir)/Compiler/runtime -I$(top_builddir)/3rdParty/gc/include -I$(top_builddir)/3rdParty/FMIL/install/include/ -I$(top_builddir)/3rdParty/lis-1.4.12/include/ -I$(builddir_inc)/sundials/ -I$(builddir_inc)/c/suitesparse/ $(CONFIG_CPPFLAGS) -DGC_REDIRECT_TO_LOCAL -DLINK_SUNDIALS_STATIC -DWIN32_LEAN_AND_MEAN
    1919
    2020# On MinGW assume that we have ipopt. For linux this is actually checked and
  • OMCompiler/SimulationRuntime/c/cmake_2.8.cmake

    raec55cb rffc3407d  
    7979if(MSVC)
    8080  add_definitions(-D_CRT_SECURE_NO_WARNINGS -DNOMINMAX -D_COMPLEX_DEFINED)
    81     # GC shall not use a dll
    82     add_definitions(-DGC_NOT_DLL)
     81
     82  add_definitions(-DWIN32_LEAN_AND_MEAN)
    8383endif(MSVC)
    8484
  • OMCompiler/SimulationRuntime/c/cmake_3.14.cmake

    r627bacf rffc3407d  
    3636
    3737target_sources(OpenModelicaRuntimeC PRIVATE ${OMC_SIMRT_GC_SOURCES} ${OMC_SIMRT_UTIL_SOURCES} ${OMC_SIMRT_META_SOURCES})
    38 target_link_libraries(OpenModelicaRuntimeC PUBLIC omc::3rd::omcgc)
    39 
    4038target_include_directories(OpenModelicaRuntimeC PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
    4139
     40# Add the define WIN32_LEAN_AND_MEAN to this lib and anything that links to it.
     41# The reason is that the define tells windows.h not to include winsock.h. We want
     42# to use winsock2.h in some 3rdParty libraries and the two can not be used simultaneously.
     43# winsock2.h is backwards compatible with winsock.h.
     44target_compile_definitions(OpenModelicaRuntimeC PUBLIC WIN32_LEAN_AND_MEAN)
     45
    4246target_link_libraries(OpenModelicaRuntimeC PUBLIC OMCPThreads::OMCPThreads)
     47target_link_libraries(OpenModelicaRuntimeC PUBLIC omc::3rd::omcgc)
    4348
    4449if(MINGW)
  • OMCompiler/SimulationRuntime/c/openmodelica.h

    r83be5f2b rffc3407d  
    7171#include "openmodelica_types.h"
    7272#if defined(__MINGW32__) || defined(_MSC_VER)
     73#if !defined(WIN32_LEAN_AND_MEAN)
    7374 #define WIN32_LEAN_AND_MEAN
     75#endif
    7476#if !defined(NOMINMAX)
    7577 #define NOMINMAX
  • OMCompiler/SimulationRuntime/c/simulation/simulation_runtime.cpp

    r68f0cde rffc3407d  
    4949#ifndef _MSC_VER
    5050  #include <regex.h>
     51#endif
     52
     53/* For CommandLineToArgvW. */
     54#if defined(__MINGW32__) || defined(_MSC_VER)
     55#include <windows.h>
     56#include <shellapi.h>
    5157#endif
    5258
  • OMCompiler/SimulationRuntime/c/util/java_interface.c

    r83be5f2b rffc3407d  
    3333#if defined(__MINGW32__) || defined(_MSC_VER) /* Windows/MinGW */
    3434
    35 #define WIN32_LEAN_AND_MEAN
    3635#include <windows.h>
    3736#define MAXPATHLEN 1024
  • OMCompiler/SimulationRuntime/c/util/omc_msvc.h

    rf11277c4 rffc3407d  
    3636
    3737#include <math.h> /* Make sure we try to get INFINITY and NAN from the system. They are way cooler */
     38/*For _MAX_PATH on MSVC */
     39#include <stdlib.h>
    3840
    3941#ifndef NaN
  • OMCompiler/SimulationRuntime/c/util/rtclock.h

    rf11277c4 rffc3407d  
    9292
    9393#if defined(__MINGW32__) || defined(_MSC_VER)
    94 #include <winsock2.h>
     94#include <windows.h>
    9595#if defined(_MSC_VER)
    9696#include <intrin.h>
Note: See TracChangeset for help on using the changeset viewer.