Пример #1
0
IoObject *IoDynLib_proto(void *state)
{
	IoMethodTable methodTable[] = {
	{"setPath", IoDynLib_setPath},
	{"path", IoDynLib_path},
	{"setInitFuncName", IoDynLib_setInitFuncName},
	{"initFuncName", IoDynLib_initFuncName},
	{"setFreeFuncName", IoDynLib_setFreeFuncName},
	{"freeFuncName", IoDynLib_freeFuncName},
	{"open", IoDynLib_open},
	{"close", IoDynLib_close},
	{"isOpen", IoDynLib_isOpen},
	{"call", IoDynLib_call},
	{"voidCall", IoDynLib_voidCall},
	{"callPluginInit", IoDynLib_callPluginInitFunc},
	//{"returnsString", IoDynLib_returnsString},
	{NULL, NULL},
	};

	IoObject *self = IoObject_new(state);
	IoObject_tag_(self, IoDynLib_newTag(state));
	IoObject_setDataPointer_(self, DynLib_new());
	DynLib_setInitArg_(DATA(self), state);
	DynLib_setFreeArg_(DATA(self), state);
	IoState_registerProtoWithId_((IoState *)state, self, protoId);

	IoObject_addMethodTable_(self, methodTable);
	return self;
}
Пример #2
0
IoDynLib *IoDynLib_rawClone(IoDynLib *proto)
{
	/*
	Note that due to the nature of this object, a clone will *NOT* inherit
	its parent's dynamically loaded object.
	*/

	IoObject *self = IoObject_rawClonePrimitive(proto);
	IoObject_setDataPointer_(self, DynLib_new());
	DynLib_setInitArg_(DATA(self), IOSTATE);
	DynLib_setFreeArg_(DATA(self), IOSTATE);
	return self;
}
Пример #3
0
void *IoCFFILibrary_rawGetFuctionPointer_(IoCFFILibrary *self, const char *name)
{
	DynLib *library = DATA(self)->library;

	if (!library)
	{
		const char *name = CSTRING(IoObject_getSlot_(self, IOSYMBOL("name")));

		library = DATA(self)->library = DynLib_new();
		DynLib_setPath_(library, name);
		DynLib_open(library);
	}

	return DynLib_pointerForSymbolName_(library, name);
}