Compilation fix for Windows
This commit is contained in:
parent
5fbe384eb0
commit
23b4832490
|
@ -21,7 +21,6 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <dlfcn.h>
|
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#ifdef WITH_SSL
|
#ifdef WITH_SSL
|
||||||
|
@ -273,6 +272,7 @@ static int _new_foreach(char const * key, Hash * value,
|
||||||
break;
|
break;
|
||||||
if(_new_append_arg(appinterface, p) != 0)
|
if(_new_append_arg(appinterface, p) != 0)
|
||||||
{
|
{
|
||||||
|
/* FIXME may crash here? */
|
||||||
appinterface->error = 1;
|
appinterface->error = 1;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -340,32 +340,28 @@ static int _new_append_arg(AppInterface * ai, char const * arg)
|
||||||
AppInterface * appinterface_new_server(char const * app)
|
AppInterface * appinterface_new_server(char const * app)
|
||||||
{
|
{
|
||||||
AppInterface * ai;
|
AppInterface * ai;
|
||||||
void * handle;
|
Plugin * handle;
|
||||||
size_t i;
|
size_t i;
|
||||||
String * name;
|
String * name;
|
||||||
|
|
||||||
if((handle = dlopen(NULL, RTLD_LAZY)) == NULL)
|
if((handle = plugin_new_self()) == NULL)
|
||||||
{
|
|
||||||
error_set_code(1, "%s", dlerror());
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
|
||||||
if((ai = appinterface_new(app)) == NULL)
|
if((ai = appinterface_new(app)) == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
for(i = 0; i < ai->calls_cnt; i++)
|
for(i = 0; i < ai->calls_cnt; i++)
|
||||||
{
|
{
|
||||||
name = string_new_append(ai->name, "_", ai->calls[i].name,
|
name = string_new_append(ai->name, "_", ai->calls[i].name,
|
||||||
NULL);
|
NULL);
|
||||||
ai->calls[i].func = dlsym(handle, name);
|
ai->calls[i].func = plugin_lookup(handle, name);
|
||||||
string_delete(name);
|
string_delete(name);
|
||||||
if(ai->calls[i].func == NULL)
|
if(ai->calls[i].func == NULL)
|
||||||
{
|
{
|
||||||
error_set_code(1, "%s", dlerror());
|
|
||||||
appinterface_delete(ai);
|
appinterface_delete(ai);
|
||||||
dlclose(handle);
|
plugin_delete(handle);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dlclose(handle);
|
plugin_delete(handle);
|
||||||
return ai;
|
return ai;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ dist=Makefile,appinterface.h
|
||||||
[libApp]
|
[libApp]
|
||||||
type=library
|
type=library
|
||||||
sources=appclient.c,appinterface.c,appserver.c
|
sources=appclient.c,appinterface.c,appserver.c
|
||||||
ldflags=`pkg-config --libs libSystem` -ldl -lsocket
|
ldflags=`pkg-config --libs libSystem` -lsocket
|
||||||
install=$(LIBDIR)
|
install=$(LIBDIR)
|
||||||
|
|
||||||
[appclient.c]
|
[appclient.c]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user