proof-of-cencept for calling wasm from php - not great, but probably ok as demo/example code?#519
Open
davidbuzz wants to merge 2 commits into
Open
proof-of-cencept for calling wasm from php - not great, but probably ok as demo/example code?#519davidbuzz wants to merge 2 commits into
davidbuzz wants to merge 2 commits into
Conversation
https://github.com/extism/extism Buzz]$ make clean ; make ; sudo make install ; time php extismcpp.php rm -f extismcpp.so extismcpp.o sudo rm -f /usr/lib/php/20220829/extismcpp.so sudo rm -f /etc/php/8.2/cli/conf.d//extismcpp.ini g++ -Wall -c -O2 -std=c++11 -fpic -o extismcpp.o extismcpp.cpp g++ -shared -o extismcpp.so extismcpp.o -lphpcpp -lextism cp -f extismcpp.so /usr/lib/php/20220829 cp -f extismcpp.ini /etc/php/8.2/cli/conf.d/ Xdebug: [Step Debug] Could not connect to debugging client. Tried: localhost:9003 (fallback through xdebug.client_host/xdebug.client_port). ExtismClass::ExtismClass([no params]) C++ reading wasm... reading WASM with read_file done WASM with read_file length:18258 C++ reading wasm done. calling extism_function_new with hello_world calling extism_plugin_new with hello function sending a string to count to count_vowels... Hello from hello_world C++! 0x7f6785c3535b hello_world:{"count": 6}[hello output done] print_plugin_output:{"count": 6}[output done] count_vowels plugin said:{"count": 6}12 Freeing userdata ------------------------------ LoadWASM count vowels result: {"count": 6} ------------------------------ ExtismClass::__destruct ExtismClass::~ExtismClass real 0m0.037s user 0m0.019s sys 0m0.019s
Author
|
Please ignore the commit with the binaries in it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
uses https://extism.org/ , and probably not a great example, but since extism claims it can integrate with go/js/node/ocaml/rust/c++/Zed/python/java/ruby/whatever , does that mean that a fully fleshed-out libextism.so might be more powerful/easier than php's FFI module?