Explorar el Código

* Add linking examples, change pcchar to pchar

Michaël Van Canneyt hace 3 años
padre
commit
769aeaae03

+ 0 - 1
packages/wasmtime/examples/gcd.lpi

@@ -7,7 +7,6 @@
         <MainUnitHasCreateFormStatements Value="False"/>
         <MainUnitHasTitleStatement Value="False"/>
         <MainUnitHasScaledStatement Value="False"/>
-        <UseDefaultCompilerOptions Value="True"/>
       </Flags>
       <SessionStorage Value="InProjectDir"/>
       <Title Value="gcd"/>

+ 1 - 1
packages/wasmtime/examples/gcd.pp

@@ -63,7 +63,7 @@ begin
   finally
     F.Free;
   end;
-  error:=wasmtime_wat2wasm(pcchar(wat.data), wat.size, @wasm);
+  error:=wasmtime_wat2wasm(pchar(wat.data), wat.size, @wasm);
   if (error<>Nil) then
     exit_with_error('failed to parse wat', error, Nil);
   wasm_byte_vec_delete(@wat);

+ 1 - 1
packages/wasmtime/examples/helloworld.pp

@@ -68,7 +68,7 @@ begin
     F.Free;
   end;
 
-  error:=wasmtime_wat2wasm(pcchar(wat.data), wat.size, @wasm);
+  error:=wasmtime_wat2wasm(pchar(wat.data), wat.size, @wasm);
   if (error<>Nil) then
     exit_with_error('failed to parse wat', error, Nil);
   wasm_byte_vec_delete(@wat);

+ 57 - 0
packages/wasmtime/examples/linking.lpi

@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<CONFIG>
+  <ProjectOptions>
+    <Version Value="12"/>
+    <General>
+      <Flags>
+        <MainUnitHasCreateFormStatements Value="False"/>
+        <MainUnitHasTitleStatement Value="False"/>
+        <MainUnitHasScaledStatement Value="False"/>
+      </Flags>
+      <SessionStorage Value="InProjectDir"/>
+      <Title Value="linking"/>
+      <UseAppBundle Value="False"/>
+      <ResourceType Value="res"/>
+    </General>
+    <BuildModes>
+      <Item Name="Default" Default="True"/>
+    </BuildModes>
+    <PublishOptions>
+      <Version Value="2"/>
+      <UseFileFilters Value="True"/>
+    </PublishOptions>
+    <RunParams>
+      <FormatVersion Value="2"/>
+    </RunParams>
+    <Units>
+      <Unit>
+        <Filename Value="linking.pp"/>
+        <IsPartOfProject Value="True"/>
+      </Unit>
+    </Units>
+  </ProjectOptions>
+  <CompilerOptions>
+    <Version Value="11"/>
+    <Target>
+      <Filename Value="linking"/>
+    </Target>
+    <SearchPaths>
+      <IncludeFiles Value="$(ProjOutDir)"/>
+      <OtherUnitFiles Value="../src"/>
+      <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
+    </SearchPaths>
+  </CompilerOptions>
+  <Debugging>
+    <Exceptions>
+      <Item>
+        <Name Value="EAbort"/>
+      </Item>
+      <Item>
+        <Name Value="ECodetoolError"/>
+      </Item>
+      <Item>
+        <Name Value="EFOpenError"/>
+      </Item>
+    </Exceptions>
+  </Debugging>
+</CONFIG>

+ 168 - 0
packages/wasmtime/examples/linking.pp

@@ -0,0 +1,168 @@
+program linking;
+
+uses classes,ctypes, wasmtime;
+
+procedure exit_with_error(message : string; error : Pwasmtime_error_t; trap: Pwasm_trap_t); cdecl;
+
+var
+  error_message : Twasm_byte_vec_t ;
+  S : AnsiString;
+begin
+  Writeln(stderr, 'error: ', message);
+  S:='';
+  if (error <> Nil)  then
+    begin
+    write('Error: ');
+    wasmtime_error_message(error, @error_message);
+    wasmtime_error_delete(error)
+    end
+  else
+    begin
+    write('Trap: ');
+    wasm_trap_message(trap, @error_message);
+    wasm_trap_delete(trap);
+    end;
+  SetLength(S,error_message.size);
+  Move(error_message.data^,S[1],error_message.size);
+  Writeln(stderr, '>>',S,'<<');
+  wasm_byte_vec_delete(@error_message);
+  halt(1);
+end;
+
+procedure checkerror(error : Pwasmtime_error_t; Message : string);
+
+begin
+  if Assigned(error) then
+    exit_with_error(message,error,Nil);
+end;
+
+procedure checkerror(error : Pwasmtime_error_t; var trap : Pwasm_trap_t; Message : string);
+
+begin
+  if Assigned(error) or assigned(Trap) then
+    exit_with_error(message,error,trap);
+end;
+
+
+Procedure read_wat_file(engine : Pwasm_engine_t; out bytes : twasm_byte_vec_t; aFile : String);
+
+var
+  wat : twasm_byte_vec_t;
+  F : TMemoryStream;
+
+begin
+  F:=TMemoryStream.Create;
+  try
+    F.LoadFromFile(aFile);
+    wasm_byte_vec_new_uninitialized(@wat, F.Size);
+    Move(F.Memory^,wat.data^,F.Size);
+  finally
+    F.Free;
+  end;
+  CheckError(wasmtime_wat2wasm(pchar(wat.data), wat.size, @bytes),
+            'failed to parse wat file '+aFile);
+  wasm_byte_vec_delete(@wat);
+end;
+
+Var
+  engine : Pwasm_engine_t = Nil;
+  store : Pwasmtime_store_t = Nil;
+  context : Pwasmtime_context_t = Nil;
+  linking1_wasm, linking2_wasm : twasm_byte_vec_t;
+  linking1_module,linking2_module : Pwasmtime_module_t;
+  error : Pwasmtime_error_t = Nil;
+  run : twasmtime_extern_t;
+  trap : Pwasm_trap_t = Nil;
+  linker : Pwasmtime_linker_t;
+  wasi_config : Pwasi_config_t;
+  status : cint;
+  linking1, linking2 : twasmtime_instance_t;
+  ok : Byte;
+
+begin
+  linking1_module:=nil;
+  linking2_module:=Nil;
+  Writeln('Loading wasm library');
+  Loadwasmtime('./'+libwasmtime);
+  Writeln('Initializing...');
+  engine := wasm_engine_new();
+  store:=wasmtime_store_new(engine, nil,nil);
+  context:=wasmtime_store_context(store);
+
+  read_wat_file(engine, linking1_wasm, 'linking1.wat');
+  read_wat_file(engine, linking2_wasm, 'linking2.wat');
+
+
+  // Now that we've got our binary webassembly we can compile our module.
+  Writeln('Compiling module...');
+
+  error:=wasmtime_module_new(engine, Puint8_t(linking1_wasm.data), linking1_wasm.size, @linking1_module);
+  wasm_byte_vec_delete(@linking1_wasm);
+  if (error <> nil) then
+    exit_with_error('failed to compile module linking1', error, nil);
+
+  error:=wasmtime_module_new(engine, Puint8_t(linking2_wasm.data), linking2_wasm.size, @linking2_module);
+  wasm_byte_vec_delete(@linking2_wasm);
+  if (error <> nil) then
+    exit_with_error('failed to compile module linking2', error, nil);
+
+  Writeln('Configuring WASI...');
+  wasi_config:=wasi_config_new();
+  if (wasi_config=nil) then
+    exit_with_error('failed to create wasi config', Nil, nil);
+
+  wasi_config_inherit_argv(wasi_config);
+  wasi_config_inherit_env(wasi_config);
+  wasi_config_inherit_stdin(wasi_config);
+  wasi_config_inherit_stdout(wasi_config);
+  wasi_config_inherit_stderr(wasi_config);
+  wasi_config_preopen_dir(wasi_config,pchar('.'),pchar('.'));
+  CheckError(wasmtime_context_set_wasi(context, wasi_config),
+             'failed to instantiate WASI');
+
+  Writeln('Creating linker...');
+  linker:= wasmtime_linker_new(engine);
+  CheckError(wasmtime_linker_define_wasi(linker),'failed to define link wasi');
+
+  // Instantiate `linking2` with our linker.
+
+  CheckError(wasmtime_linker_instantiate(linker, context, linking2_module, @linking2, @trap),Trap,
+             'failed to instantiate linking2');
+  // Register our new `linking2` instance with the linker
+  CheckError(wasmtime_linker_define_instance(linker, context, PChar('linking2'), Length('linking2'), @linking2),
+            'failed to link linking2');
+
+  // Instantiate `linking1` with the linker now that `linking2` is defined
+  CheckError(wasmtime_linker_instantiate(linker, context, linking1_module, @linking1, @trap),trap,
+              'failed to instantiate linking1');
+
+  Writeln('Extracting export...');
+  ok:=wasmtime_instance_export_get(context, @linking1, PChar('run'), 3, @run) ;
+  if OK=0 then
+    exit_with_error('failed to get run export', nil, nil);
+  if run.kind<>WASMTIME_EXTERN_FUNC then
+    exit_with_error('run is not a function', nil, nil);
+  // And call it!
+  Writeln('Calling export...');
+  error:=wasmtime_func_call(context, @run.of_.func, nil, 0, nil, 0, @trap);
+  if (Trap<>Nil) then
+    begin
+    // exit_proc is reported as trap.
+    if wasmtime_trap_exit_status(trap,@status)<>0 then
+      Writeln('Wasm program exited with status: ',Status)
+    else
+      exit_with_error('failed to run default export for module', error, trap);
+    end
+  else if (error<>nil) then
+    exit_with_error('failed to run default export for module', error, trap);
+
+  // Clean up after ourselves at this point
+  Writeln('All finished!');
+  wasmtime_linker_delete(linker);
+  wasmtime_module_delete(linking1_module);
+  wasmtime_module_delete(linking2_module);
+  wasmtime_store_delete(store);
+  wasm_engine_delete(engine);
+
+end.
+

+ 22 - 0
packages/wasmtime/examples/linking1.wat

@@ -0,0 +1,22 @@
+(module
+  (import "linking2" "double" (func $double (param i32) (result i32)))
+  (import "linking2" "log" (func $log (param i32 i32)))
+  (import "linking2" "memory" (memory 1))
+  (import "linking2" "memory_offset" (global $offset i32))
+
+  (func (export "run")
+    ;; Call into the other module to double our number, and we could print it
+    ;; here but for now we just drop it
+    i32.const 2
+    call $double
+    drop
+
+    ;; Our `data` segment initialized our imported memory, so let's print the
+    ;; string there now.
+    global.get $offset
+    i32.const 14
+    call $log
+  )
+
+  (data (global.get $offset) "Hello, world!\n")
+)

+ 33 - 0
packages/wasmtime/examples/linking2.wat

@@ -0,0 +1,33 @@
+(module
+  (type $fd_write_ty (func (param i32 i32 i32 i32) (result i32)))
+  (import "wasi_snapshot_preview1" "fd_write" (func $fd_write (type $fd_write_ty)))
+
+  (func (export "double") (param i32) (result i32)
+    local.get 0
+    i32.const 2
+    i32.mul
+  )
+
+  (func (export "log") (param i32 i32)
+    ;; store the pointer in the first iovec field
+    i32.const 4
+    local.get 0
+    i32.store
+
+    ;; store the length in the first iovec field
+    i32.const 4
+    local.get 1
+    i32.store offset=4
+
+    ;; call the `fd_write` import
+    i32.const 1     ;; stdout fd
+    i32.const 4     ;; iovs start
+    i32.const 1     ;; number of iovs
+    i32.const 0     ;; where to write nwritten bytes
+    call $fd_write
+    drop
+  )
+
+  (memory (export "memory") 2)
+  (global (export "memory_offset") i32 (i32.const 65536))
+)

+ 0 - 1
packages/wasmtime/examples/memory.lpi

@@ -7,7 +7,6 @@
         <MainUnitHasCreateFormStatements Value="False"/>
         <MainUnitHasTitleStatement Value="False"/>
         <MainUnitHasScaledStatement Value="False"/>
-        <UseDefaultCompilerOptions Value="True"/>
       </Flags>
       <SessionStorage Value="InProjectDir"/>
       <Title Value="memory"/>

+ 1 - 1
packages/wasmtime/examples/memory.pp

@@ -196,7 +196,7 @@ begin
     F.Free;
   end;
 
-  error:=wasmtime_wat2wasm(pcchar(wat.data), wat.size, @wasm);
+  error:=wasmtime_wat2wasm(pchar(wat.data), wat.size, @wasm);
   if (error<>Nil) then
     exit_with_error('failed to parse wat', error, Nil);
   wasm_byte_vec_delete(@wat);

+ 19 - 19
packages/wasmtime/src/wasmtime.pp

@@ -189,7 +189,7 @@ Type
   PPwasm_trap_t= ^Pwasm_trap_t;
   PPwasmtime_module_t = ^Pwasmtime_module_t;
   
-  Ppcchar = ^pchar;
+  Ppchar = ^pchar;
   Tcint = cint;
   Tbyte_t = byte;
   Tfloat32_t = single;
@@ -790,15 +790,15 @@ var
   wasm_instance_new : function(_para1:Pwasm_store_t; _para2:Pwasm_module_t; imports:Pwasm_extern_vec_t; _para4:PPwasm_trap_t):Pwasm_instance_t; cdecl;
   wasm_instance_exports : procedure(_para1:Pwasm_instance_t; out_:Pwasm_extern_vec_t); cdecl;
   wasi_config_new : function:Pwasi_config_t; cdecl;
-  wasi_config_set_argv : procedure(config:Pwasi_config_t; argc:Tcint; argv:Ppcchar); cdecl;
+  wasi_config_set_argv : procedure(config:Pwasi_config_t; argc:Tcint; argv:Ppchar); cdecl;
   wasi_config_inherit_argv : procedure(config:Pwasi_config_t); cdecl;
-  wasi_config_set_env : procedure(config:Pwasi_config_t; envc:Tcint; names:Ppcchar; values:Ppcchar); cdecl;
+  wasi_config_set_env : procedure(config:Pwasi_config_t; envc:Tcint; names:Ppchar; values:Ppchar); cdecl;
   wasi_config_inherit_env : procedure(config:Pwasi_config_t); cdecl;
-  wasi_config_set_stdin_file : function(config:Pwasi_config_t; path:pcchar):T_Bool;
+  wasi_config_set_stdin_file : function(config:Pwasi_config_t; path:pchar):T_Bool;
   wasi_config_inherit_stdin : procedure(config:Pwasi_config_t); cdecl;
-  wasi_config_set_stdout_file : function(config:Pwasi_config_t; path:pcchar):T_Bool;
+  wasi_config_set_stdout_file : function(config:Pwasi_config_t; path:pchar):T_Bool;
   wasi_config_inherit_stdout : procedure(config:Pwasi_config_t); cdecl;
-  wasi_config_set_stderr_file : function(config:Pwasi_config_t; path:pcchar):T_Bool;
+  wasi_config_set_stderr_file : function(config:Pwasi_config_t; path:pchar):T_Bool;
   wasi_config_inherit_stderr : procedure(config:Pwasi_config_t); cdecl;
   wasi_config_preopen_dir : function(config:Pwasi_config_t; path:pchar; guest_path:pchar):T_Bool;
   wasmtime_error_delete : procedure(error:Pwasmtime_error_t); cdecl;
@@ -822,7 +822,7 @@ var
   wasmtime_config_static_memory_maximum_size_set : procedure(_para1:Pwasm_config_t; _para2:Tuint64_t); cdecl;
   wasmtime_config_static_memory_guard_size_set : procedure(_para1:Pwasm_config_t; _para2:Tuint64_t); cdecl;
   wasmtime_config_dynamic_memory_guard_size_set : procedure(_para1:Pwasm_config_t; _para2:Tuint64_t); cdecl;
-  wasmtime_config_cache_config_load : function(_para1:Pwasm_config_t; _para2:pcchar):Pwasmtime_error_t; cdecl;
+  wasmtime_config_cache_config_load : function(_para1:Pwasm_config_t; _para2:pchar):Pwasmtime_error_t; cdecl;
   wasmtime_moduletype_delete : procedure(ty:Pwasmtime_moduletype_t); cdecl;
   wasmtime_moduletype_imports : procedure(_para1:Pwasmtime_moduletype_t; out_:Pwasm_importtype_vec_t); cdecl;
   wasmtime_moduletype_exports : procedure(_para1:Pwasmtime_moduletype_t; out_:Pwasm_exporttype_vec_t); cdecl;
@@ -835,7 +835,7 @@ var
   wasmtime_module_type : function(_para1:Pwasmtime_module_t):Pwasmtime_moduletype_t; cdecl;
   wasmtime_module_serialize : function(module:Pwasmtime_module_t; ret:Pwasm_byte_vec_t):Pwasmtime_error_t; cdecl;
   wasmtime_module_deserialize : function(engine:Pwasm_engine_t; bytes:Puint8_t; bytes_len:Tsize_t; ret:PPwasmtime_module_t):Pwasmtime_error_t; cdecl;
-  wasmtime_module_deserialize_file : function(engine:Pwasm_engine_t; path:pcchar; ret:PPwasmtime_module_t):Pwasmtime_error_t; cdecl;
+  wasmtime_module_deserialize_file : function(engine:Pwasm_engine_t; path:pchar; ret:PPwasmtime_module_t):Pwasmtime_error_t; cdecl;
   wasmtime_store_new : function(engine:Pwasm_engine_t; data:pointer; finalizer: TFinalizer):Pwasmtime_store_t; cdecl;
   wasmtime_store_context : function(store:Pwasmtime_store_t):Pwasmtime_context_t; cdecl;
   wasmtime_store_delete : procedure(store:Pwasmtime_store_t); cdecl;
@@ -867,7 +867,7 @@ var
   wasmtime_func_call : function(store:Pwasmtime_context_t; func:Pwasmtime_func_t; args:Pwasmtime_val_t; nargs:Tsize_t; results:Pwasmtime_val_t; 
       nresults:Tsize_t; trap:PPwasm_trap_t):Pwasmtime_error_t; cdecl;
   wasmtime_func_call_unchecked : function(store:Pwasmtime_context_t; func:Pwasmtime_func_t; args_and_results:Pwasmtime_val_raw_t):Pwasm_trap_t; cdecl;
-  wasmtime_caller_export_get : function(caller:Pwasmtime_caller_t; name:pcchar; name_len:Tsize_t; item:Pwasmtime_extern_t):T_Bool;
+  wasmtime_caller_export_get : function(caller:Pwasmtime_caller_t; name:pchar; name_len:Tsize_t; item:Pwasmtime_extern_t):T_Bool;
   wasmtime_caller_context : function(caller:Pwasmtime_caller_t):Pwasmtime_context_t; cdecl;
   wasmtime_func_from_raw : procedure(context:Pwasmtime_context_t; raw:Tsize_t; ret:Pwasmtime_func_t); cdecl;
   wasmtime_func_to_raw : function(context:Pwasmtime_context_t; func:Pwasmtime_func_t):Tsize_t; cdecl;
@@ -883,23 +883,23 @@ var
       trap:PPwasm_trap_t):Pwasmtime_error_t; cdecl;
   wasmtime_instance_type : function(store:Pwasmtime_context_t; instance:Pwasmtime_instance_t):Pwasmtime_instancetype_t; cdecl;
   wasmtime_instance_export_get : function(store:Pwasmtime_context_t; instance:Pwasmtime_instance_t; name:pchar; name_len:Tsize_t; item:Pwasmtime_extern_t):T_Bool;
-  wasmtime_instance_export_nth : function(store:Pwasmtime_context_t; instance:Pwasmtime_instance_t; index:Tsize_t; name:Ppcchar; name_len:Psize_t; 
+  wasmtime_instance_export_nth : function(store:Pwasmtime_context_t; instance:Pwasmtime_instance_t; index:Tsize_t; name:Ppchar; name_len:Psize_t; 
       item:Pwasmtime_extern_t):T_Bool;
   wasmtime_linker_new : function(engine:Pwasm_engine_t):Pwasmtime_linker_t; cdecl;
   wasmtime_linker_delete : procedure(linker:Pwasmtime_linker_t); cdecl;
   wasmtime_linker_allow_shadowing : procedure(linker:Pwasmtime_linker_t; allow_shadowing:T_Bool); cdecl;
-  wasmtime_linker_define : function(linker:Pwasmtime_linker_t; module:pcchar; module_len:Tsize_t; name:pcchar; name_len:Tsize_t; 
+  wasmtime_linker_define : function(linker:Pwasmtime_linker_t; module:pchar; module_len:Tsize_t; name:pchar; name_len:Tsize_t; 
       item:Pwasmtime_extern_t):Pwasmtime_error_t; cdecl;
-  wasmtime_linker_define_func : function(linker:Pwasmtime_linker_t; module:pcchar; module_len:Tsize_t; name:pcchar; name_len:Tsize_t; 
+  wasmtime_linker_define_func : function(linker:Pwasmtime_linker_t; module:pchar; module_len:Tsize_t; name:pchar; name_len:Tsize_t; 
       ty:Pwasm_functype_t; cb:Twasmtime_func_callback_t; data:pointer; finalizer: TFInalizer):Pwasmtime_error_t; cdecl;
-  wasmtime_linker_define_func_unchecked : function(linker:Pwasmtime_linker_t; module:pcchar; module_len:Tsize_t; name:pcchar; name_len:Tsize_t; 
+  wasmtime_linker_define_func_unchecked : function(linker:Pwasmtime_linker_t; module:pchar; module_len:Tsize_t; name:pchar; name_len:Tsize_t; 
       ty:Pwasm_functype_t; cb:Twasmtime_func_unchecked_callback_t; data:pointer; finalizer: TFInalizer):Pwasmtime_error_t; cdecl;
   wasmtime_linker_define_wasi : function(linker:Pwasmtime_linker_t):Pwasmtime_error_t; cdecl;
-  wasmtime_linker_define_instance : function(linker:Pwasmtime_linker_t; store:Pwasmtime_context_t; name:pcchar; name_len:Tsize_t; instance:Pwasmtime_instance_t):Pwasmtime_error_t; cdecl;
+  wasmtime_linker_define_instance : function(linker:Pwasmtime_linker_t; store:Pwasmtime_context_t; name:pchar; name_len:Tsize_t; instance:Pwasmtime_instance_t):Pwasmtime_error_t; cdecl;
   wasmtime_linker_instantiate : function(linker:Pwasmtime_linker_t; store:Pwasmtime_context_t; module:Pwasmtime_module_t; instance:Pwasmtime_instance_t; trap:PPwasm_trap_t):Pwasmtime_error_t; cdecl;
-  wasmtime_linker_module : function(linker:Pwasmtime_linker_t; store:Pwasmtime_context_t; name:pcchar; name_len:Tsize_t; module:Pwasmtime_module_t):Pwasmtime_error_t; cdecl;
-  wasmtime_linker_get_default : function(linker:Pwasmtime_linker_t; store:Pwasmtime_context_t; name:pcchar; name_len:Tsize_t; func:Pwasmtime_func_t):Pwasmtime_error_t; cdecl;
-  wasmtime_linker_get : function(linker:Pwasmtime_linker_t; store:Pwasmtime_context_t; module:pcchar; module_len:Tsize_t; name:pcchar; 
+  wasmtime_linker_module : function(linker:Pwasmtime_linker_t; store:Pwasmtime_context_t; name:pchar; name_len:Tsize_t; module:Pwasmtime_module_t):Pwasmtime_error_t; cdecl;
+  wasmtime_linker_get_default : function(linker:Pwasmtime_linker_t; store:Pwasmtime_context_t; name:pchar; name_len:Tsize_t; func:Pwasmtime_func_t):Pwasmtime_error_t; cdecl;
+  wasmtime_linker_get : function(linker:Pwasmtime_linker_t; store:Pwasmtime_context_t; module:pchar; module_len:Tsize_t; name:pchar; 
       name_len:Tsize_t; item:Pwasmtime_extern_t):T_Bool;
   wasmtime_memorytype_new : function(min:Tuint64_t; max_present:T_Bool; max:Tuint64_t; is_64:T_Bool):Pwasm_memorytype_t; cdecl;
   wasmtime_memorytype_minimum : function(ty:Pwasm_memorytype_t):Tuint64_t; cdecl;
@@ -917,12 +917,12 @@ var
   wasmtime_table_set : function(store:Pwasmtime_context_t; table:Pwasmtime_table_t; index:Tuint32_t; value:Pwasmtime_val_t):Pwasmtime_error_t; cdecl;
   wasmtime_table_size : function(store:Pwasmtime_context_t; table:Pwasmtime_table_t):Tuint32_t; cdecl;
   wasmtime_table_grow : function(store:Pwasmtime_context_t; table:Pwasmtime_table_t; delta:Tuint32_t; init:Pwasmtime_val_t; prev_size:Puint32_t):Pwasmtime_error_t; cdecl;
-  wasmtime_trap_new : function(msg:pcchar; msg_len:Tsize_t):Pwasm_trap_t; cdecl;
+  wasmtime_trap_new : function(msg:pchar; msg_len:Tsize_t):Pwasm_trap_t; cdecl;
   wasmtime_trap_code : function(_para1:Pwasm_trap_t; code:Pwasmtime_trap_code_t):T_Bool;
   wasmtime_trap_exit_status : function(_para1:Pwasm_trap_t; status:pcint):T_Bool;
   wasmtime_frame_func_name : function(_para1:Pwasm_frame_t):Pwasm_name_t; cdecl;
   wasmtime_frame_module_name : function(_para1:Pwasm_frame_t):Pwasm_name_t; cdecl;
-  wasmtime_wat2wasm : function(wat:pcchar; wat_len:Tsize_t; ret:Pwasm_byte_vec_t):Pwasmtime_error_t; cdecl;
+  wasmtime_wat2wasm : function(wat:pchar; wat_len:Tsize_t; ret:Pwasm_byte_vec_t):Pwasmtime_error_t; cdecl;
   wasi_config_delete : procedure(_para1:Pwasi_config_t); cdecl;
 
 // Converted Inline functions