diff --git a/third-party/llhttp/README.md b/third-party/llhttp/README.md index 4b3c7da0..fb31ce2c 100644 --- a/third-party/llhttp/README.md +++ b/third-party/llhttp/README.md @@ -92,6 +92,15 @@ if (err == HPE_OK) { ``` For more information on API usage, please refer to [src/native/api.h](https://github.com/nodejs/llhttp/blob/main/src/native/api.h). +## Build Instructions + +Make sure you have [Node.js](https://nodejs.org/), npm and npx installed. Then under project directory run: + +```sh +npm install +make +``` + --- ### Bindings to other languages @@ -99,7 +108,6 @@ For more information on API usage, please refer to [src/native/api.h](https://gi * Python: [pallas/pyllhttp][8] * Ruby: [metabahn/llhttp][9] - ### Using with CMake If you want to use this library in a CMake project you can use the snippet below. @@ -113,6 +121,28 @@ FetchContent_MakeAvailable(llhttp) target_link_libraries(${EXAMPLE_PROJECT_NAME} ${PROJECT_LIBRARIES} llhttp ${PROJECT_NAME}) ``` +## Building on Windows + +### Installation + +* `choco install git` +* `choco install node` +* `choco install llvm` (or install the `C++ Clang tools for Windows` optional package from the Visual Studio 2019 installer) +* `choco install make` (or if you have MinGW, it comes bundled) + +1. Ensure that `Clang` and `make` are in your system path. +2. Using Git Bash, clone the repo to your preferred location. +3. Cd into the cloned directory and run `npm install` +5. Run `make` +6. Your `repo/build` directory should now have `libllhttp.a` and `libllhttp.so` static and dynamic libraries. +7. When building your executable, you can link to these libraries. Make sure to set the build folder as an include path when building so you can reference the declarations in `repo/build/llhttp.h`. + +### A simple example on linking with the library: + +Assuming you have an executable `main.cpp` in your current working directory, you would run: `clang++ -Os -g3 -Wall -Wextra -Wno-unused-parameter -I/path/to/llhttp/build main.cpp /path/to/llhttp/build/libllhttp.a -o main.exe`. + +If you are getting `unresolved external symbol` linker errors you are likely attempting to build `llhttp.c` without linking it with object files from `api.c` and `http.c`. + #### LICENSE This software is licensed under the MIT License. diff --git a/third-party/llhttp/include/llhttp.h b/third-party/llhttp/include/llhttp.h index 94b14988..698c5536 100644 --- a/third-party/llhttp/include/llhttp.h +++ b/third-party/llhttp/include/llhttp.h @@ -374,8 +374,6 @@ LLHTTP_EXPORT void llhttp_init(llhttp_t* parser, llhttp_type_t type, const llhttp_settings_t* settings); -#if defined(__wasm__) - LLHTTP_EXPORT llhttp_t* llhttp_alloc(llhttp_type_t type); @@ -400,8 +398,6 @@ int llhttp_get_status_code(llhttp_t* parser); LLHTTP_EXPORT uint8_t llhttp_get_upgrade(llhttp_t* parser); -#endif // defined(__wasm__) - /* Reset an already initialized parser back to the start state, preserving the * existing parser type, callback settings, user data, and lenient flags. */