https://github.com/warmist/file_to_obj
Converts any file to linkable x64 obj file for msvc. This way you don't need to compile C file (e.g. from xd) and you dont need to mess with resource files etc...
https://github.com/warmist/file_to_obj
linking msvc programming utility
Last synced: 4 months ago
JSON representation
Converts any file to linkable x64 obj file for msvc. This way you don't need to compile C file (e.g. from xd) and you dont need to mess with resource files etc...
- Host: GitHub
- URL: https://github.com/warmist/file_to_obj
- Owner: warmist
- Created: 2018-09-06T18:56:56.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-10-28T09:05:31.000Z (almost 6 years ago)
- Last Synced: 2025-03-06T10:55:53.075Z (7 months ago)
- Topics: linking, msvc, programming, utility
- Language: C++
- Size: 19.5 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# file_to_obj
Converts any file to linkable x64 obj file for msvc. This way you don't need to compile C file (e.g. from xd) and you dont need to mess with resource files etc...# Usage
For use with cmake:
* Put the included (in assets dir) `EmbedFileFTO.cmake` into your `CMAKE_MODULE_PATH`
* `include("cmake/EmbedFileFTO.cmake")` somewhere in your `cmakelists.txt`
* `embed_file( )`
* add to `add_executable(...)` optionaly: `${EMBEDDED_HDRS}` and mandatory: `${EMBEDDED_LIBS}`
* `include_directories(${PROJECT_BINARY_DIR})` because i forget if it already looks for headers there?
* in your cpp file `#include ".hpp"` and it will contain: `EMB_FILE_` and `EMB_FILE_SIZE_`
* Have fun!# WHY?
Not sure... Probably sanity is getting low... And i liked the `ld` having that power and basically alternatives: [here](https://stackoverflow.com/questions/4864866/c-c-with-gcc-statically-add-resource-files-to-executable-library)
# Resources
* https://docs.microsoft.com/en-us/windows/desktop/Debug/pe-format
* http://www.delorie.com/djgpp/doc/coff/
* https://www.agner.org/optimize/calling_conventions.pdf