- Add BUILD_MODE_LIB constant to CompilerBase class - Implement isBuildModeLib and isBuildModeEmbed methods for library detection - Update Clang backend to handle lib build mode with -fPIC flag and DLL linking - Modify GccLikeBackend to support lib build mode with shared library flags - Update MSVC backend to handle lib build mode with DLL compilation - Extend PlatformBase to return correct extensions for lib builds - Add proper handling for misc directory files during preprocessing - Create new example project demonstrating library build functionality - Update Translator to include main.cc for embed modes and add PHPX_NO_MAIN define for libraries - Expand mode mapping to accept multiple library-related build mode aliases - Increment version number from 1082 to 1084 - Update documentation to reflect new lib build option alongside bin and ext modespull/16/head
parent
d2b7a36430
commit
7e28e8441b
13 changed files with 85 additions and 15 deletions
@ -0,0 +1,19 @@ |
||||
#include <php_typephp_lib_demo_func_decl.h> |
||||
|
||||
#ifdef _WIN32 |
||||
#define TYPEPHP_API extern "C" __declspec(dllexport) |
||||
#else |
||||
#define TYPEPHP_API extern "C" __attribute__((visibility("default"))) |
||||
#endif |
||||
|
||||
extern "C" int php_aot_runtime_init(int argc, char **argv); |
||||
|
||||
TYPEPHP_API int typephp_lib_demo_add(int a, int b) |
||||
{ |
||||
char app_name[] = "typephp_lib_demo"; |
||||
char *argv[] = {app_name, nullptr}; |
||||
if (php_aot_runtime_init(1, argv) != 0) { |
||||
return 0; |
||||
} |
||||
return static_cast<int>(php_demo_add(a, b)); |
||||
} |
||||
@ -0,0 +1,8 @@ |
||||
<?php |
||||
|
||||
declare(strict_types=1); |
||||
|
||||
function demo_add(int $a, int $b): int |
||||
{ |
||||
return $a + $b; |
||||
} |
||||
@ -0,0 +1,7 @@ |
||||
name: typephp_lib_demo |
||||
mode: lib |
||||
version: 0.1.0 |
||||
cxx-std: c++17 |
||||
sources: |
||||
- php-src |
||||
- cpp-src |
||||
@ -1 +1 @@ |
||||
1082 |
||||
1084 |
||||
Loading…
Reference in new issue