I am using G-WAN 4.11.20
init.c
#pragma link "mono-2.0"
#pragma include "/home/igor/Projects/gwan_linux64-bit/mono-3.0.2"
#include "gwan.h" // G-WAN API
#include <mono/metadata/metadata.h>
#include <mono/metadata/loader.h>
#include <mono/metadata/object.h>
static MonoString* Sample ()
{
return mono_string_new (mono_domain_get (), "Hello!");
}
int main(int argc, char *argv[])
{
mono_add_internal_call("Gwan::Sample", Sample);
return 0;
}
gwan_api.cs
public class Gwan
{
[MethodImplAttribute(MethodImplOptions.InternalCall)]
extern public static string Sample();
}
gwan is starting with assertion:
ghashtable.c:236: assertion 'hash != NULL' failed
Than after calling script, I am getting the same problem.
Unhandled Exception: System.MissingMethodException: Cannot find the requested method.
at (wrapper managed-to-native) Gwan:Sample ()
at hello2.Main (System.String[] args) [0x00000] in <filename unknown>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.MissingMethodException: Cannot find the requested method.
at (wrapper managed-to-native) Gwan:Sample ()
at hello2.Main (System.String[] args) [0x00000] in <filename unknown>:0
My feeling is that I don't configure mono right, any suggestions?
Unlike main.c
(the maintenance script) the init.c
script must terminate for the G-WAN server to start listening.
Since the init.c
code is released after its execution, this makes it a poor candidate for storing persistent code supposed to be called by G-WAN servlets to build dynamic contents for client requests.
You probably woul have more chances with main.c
, or a G-WAN connection handler.