On Thursday, 27 August 2015 at 13:08:18 UTC, ddos wrote:
On Thursday, 27 August 2015 at 11:34:36 UTC, John Colvin wrote:
P.S. this would be better asked in http://forum.dlang.org/group/learn or http://forum.rejectedsoftware.com

made a thread before on the vibe forum too, see here http://forum.rejectedsoftware.com/groups/rejectedsoftware.vibed/thread/26343/

On Thursday, 27 August 2015 at 11:34:36 UTC, John Colvin wrote:
Firstly, try with up-to-date vibe.d and zmqd.
What happens if you remove some of those dependencies? If you remove targetType dynamicLibrary? Is it just vibe.d on it's own that is causing the problem, or is it a combination?

thx for the input, i've pulled out a smaller testing example from my codebase using only vibe as a dependency. if i compile this code as executable everything works as expected. Compiling it as a dynamicLibrary fails when the library is loaded.

if this is of any help, that is the program the shared library is loaded into
https://github.com/IceNinjaman/CoD4X17a_testing/
the used compile script: https://github.com/IceNinjaman/CoD4X17a_testing/blob/master/build_cod4x17a_elf_nopunkbuster.sh

{
  "name": "vibefailtest",
  "description": "A minimal D application.",
  "copyright": "Copyright © 2015, vagrant",
  "authors": ["vagrant"],
  "targetType": "dynamicLibrary",
  "dependencies": {
    "vibe-d": "~>0.7.25-alpha.1",
  },
  "versions": ["VibeCustomMain"]
}

import std.stdio;
import vibe.d;

struct version_t
{
    int major;
    int minor;
}

align(1) struct pluginInfo_t{ // To be used in OnInfoRequest
align(1):
version_t handlerVersion; // Requested plugin handler version - mandatory field version_t pluginVersion; // Version of your plugin - optional char[64] fullName; // Full plugin name, short name is the filename without extension - optional char[128] shortDescription; // Describe in a few words what this plugin does - optional
    char[1024] longDescription; // Full description - optional
}

extern (C) void OnInfoRequest(pluginInfo_t *info)
{
  info.handlerVersion = version_t(2, 302);
  info.pluginVersion = version_t(0, 1);
}

extern (C) int OnInit()
{
  printf(">>>>>>>> init\n");
  return 0;
}

void main(){
  OnInit();
}

I think your problem is that you need to initialise the D runtime. Perhaps adding a call to http://dlang.org/phobos/core_runtime.html#.Runtime.initialize inside OnInit will solve it for you. Also, remember to terminate the runtime when the plugin is unloaded.

Reply via email to