This topic was marked solved by its starter, on August 26th, 2018, 11:10 AM
« Menu
[Plugin SDK] Some VCMP functions cause a segmentation fault

EK.IceFlake

  • Hero Member
  • "We are the champions my fellahs" - Sufyan/VK.SuFy
  • Posts: 1,761
[Plugin SDK] Some VCMP functions cause a segmentation fault
«  »
I'm trying to create a C# plugin. I have a PlugunFunctions struct but unfortunately a few functions in it don't work.

If, for example, I execute
Code: [Select]
pluginFuncs.LogMessage("%s", "Hello World");
it prints Hello World.
If I execute
Code: [Select]
error = pluginFuncs.GetLastError();
Console.WriteLine(error);
it prints None.

However, if I execute, for example
Code: [Select]
pluginFuncs.SetMaxPlayers(54);
it causes a segmentation fault somewhere (gdb can't figure it out. it just shows the address of the location)
and if I execute
Code: [Select]
StringBuilder serverNameBuilder = new StringBuilder(129);
            VcmpError error = pluginFuncs.GetServerName(serverNameBuilder, (UIntPtr) 128);
            Console.WriteLine("Error code: " + error.ToString());
            Console.WriteLine("Server name: " + serverNameBuilder.ToString());
it causes a segmentation fault at strcpy.

Here's the relevant code: https://gist.github.com/iFlake/d0bd57a293d92790480535483de84e74

Any idea? I'm summoning @Stormeus since they're working on VC.Net.

Thanks.

« Menu