Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sources also compile under Ubuntu 20.04.02 LTS #22

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

hneema08
Copy link

With these updates, the EMOD source code will become more generic and really cross platform -- it should compile without modification for both Windows and Linux platforms. I tested it only under Ubuntu 20.04.02 LTS. The summary of the changes is below:

  1. All reporter DLLs now use cross platform code (e.g., LoadLibrary for Windows and dlopen for Unix). Any Windows specific code was bracketed using #ifdef WIN32 and #endif pre-processors.
  2. DllInterfaceHelper.h had a bug in using const_cast.
  3. A major rewrite of DLLLoader.h and DLLLoader.cpp for making them cross platform.
  4. Added several utility functions such as converting std::string to wstring and back.
  5. Added an _exit(0) at the end of main function to avoid seg faults that occur due to some existing memory leak (this still needs to be debugged in the future for fixing the memory leak and then this _exit statement can be removed.
  6. Updated all Makefiles to use c++14 compilation.
  7. Use all lowercase filenames consistently for "stdafx.h" (In Windows it doesn't matter, but it does in Unix).
  8. All Windows specific code in stdafx.h was surrounded by preprocessors #ifdef WIN32 and #endif.
  9. Updated DLLDefs.h to define __cdecl to nothing for non-Windows platforms.
  10. Updated all reporter plugins DLL/shared-library code to include the right case "stdafx.h", ensuring DLLDefs.h get included to get the definition of __cdecl, use right case for including "IdmDateTime.h", using correct platform-dependent functions for checking whether a number is NAN or finite,
  11. Fixed some UNICODE characters to work correctly under Unix.
  12. In Simulation.cpp enabled loading of custom reporter shared object for Unix platforms (previously that was only compiled on Windows), and enabled freeing of memory in its destructor.
  13. Fixed Environment.h and Environment.cpp for correct usage of Static variable for the Environment pointer in custom reporters.
  14. Updated SConscript and SConstruct for compiling with flags --std=c++14 and -fPIC, using python 3.9, and a couple of minor bug fixes.
  15. Added .sconf_temp generated folder (that includes a dummy C++ file for scons to be able to check for C++ compiler) to .gitignore

…. The code is now more generic and should compile without modification for both Windows and Linux platforms.
@Bridenbecker
Copy link

@hneema08 Thank you for making this pull request and for your interest in EMOD. We are definitely doing more to support EMOD on Linux and your changes will be helpful.

@hneema08
Copy link
Author

hneema08 commented Feb 7, 2022

@Bridenbecker Thanks for your response. It will be great to know when you can incorporate these updates (as appropriate) into the main line (even if you do not yet make a release)? We are actively using EMOD in our research projects. I'd rather work from your master branch than my custom code. Thanks!

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.

None yet

2 participants