Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (dr_panther, AndrewAMD, TedMar), 1,371 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
[SOLVED] Issues setting up plugins #433131
11/25/13 01:36
11/25/13 01:36
Joined: Jan 2005
Posts: 330
USA
M
MatAllum Offline OP
Senior Member
MatAllum  Offline OP
Senior Member
M

Joined: Jan 2005
Posts: 330
USA
I'm relatively new to the use of lite-c (long time c-script user here) and I'm having some issues getting the plugin system to work. I've written a plugin for our team project that allows easy customization of game parameters, but actually getting A8 to recognize it is another story.

The manual tells me I can just drop the DLL in the acknex_plugins folder; I've tried that as well as having it directly in the working game folder to no avail. The impression I've gotten is I only need to prototype the DLL functions and they will just work. SED still recognizes dll_open but the manual says I haven't needed it since A6.

Below is the sample code; the engine complains on startup that I'm calling an empty function. Am I missing something?

Code:
#include <acknex.h>

function registerObjectType(STRING* name, var objectSize);
function registerVariable(STRING* name, var targetObjectType);
function loadConfigData(STRING* name);
function getObjectIndex(STRING* name);
function getDataStructure(var* destination, var type, var index);

function main()
{
	registerObjectType("Test", 4);
}


Last edited by MatAllum; 11/26/13 12:52.
Re: Issues setting up plugins [Re: MatAllum] #433148
11/25/13 10:21
11/25/13 10:21
Joined: Oct 2007
Posts: 5,210
İstanbul, Turkey
Quad Offline
Senior Expert
Quad  Offline
Senior Expert

Joined: Oct 2007
Posts: 5,210
İstanbul, Turkey
This part does not help at all, how you define your functions in your DLL code?


3333333333
Re: Issues setting up plugins [Re: Quad] #433152
11/25/13 12:24
11/25/13 12:24
Joined: Jan 2005
Posts: 330
USA
M
MatAllum Offline OP
Senior Member
MatAllum  Offline OP
Senior Member
M

Joined: Jan 2005
Posts: 330
USA
Like this:

Code:
DLLFUNC var registerObjectType(STRING* name, var objectSize)
{
    int result = OTL.createObjectType(std::string(name->chars), _INT(objectSize));
    return(_VAR(result));
}

DLLFUNC void registerVariable(STRING* name, var targetObjectType)
{
    OTL.registerVariable(_INT(targetObjectType), std::string(name->chars));
}

DLLFUNC void loadConfigData(STRING* name)
{
    OTL.loadFileData(std::string(name->chars));
}

DLLFUNC var getObjectIndex(STRING* name)
{
    int result = OTL.objectIndexForName(std::string(name->chars));
    return(_VAR(result));
}

DLLFUNC void getDataStructure(var* destination, var type, var index)
{
    OTL.retrieveStruct(destination, _INT(type), _INT(index));
}


Re: Issues setting up plugins [Re: MatAllum] #433153
11/25/13 12:49
11/25/13 12:49
Joined: Feb 2010
Posts: 320
TANA/Madagascar
3dgs_snake Offline
Senior Member
3dgs_snake  Offline
Senior Member

Joined: Feb 2010
Posts: 320
TANA/Madagascar
And you need to add
Code:
BOOL APIENTRY DllMain( 
	HANDLE hModule,
	DWORD ul_reason_for_call,
	LPVOID lpReserved)
{
	engine_bind();
	return TRUE;
}


Re: Issues setting up plugins [Re: 3dgs_snake] #433154
11/25/13 12:53
11/25/13 12:53
Joined: Jan 2005
Posts: 330
USA
M
MatAllum Offline OP
Senior Member
MatAllum  Offline OP
Senior Member
M

Joined: Jan 2005
Posts: 330
USA
Yeah, that's in there, as well as including adll.h.

Re: Issues setting up plugins [Re: MatAllum] #433155
11/25/13 13:44
11/25/13 13:44
Joined: Oct 2007
Posts: 5,210
İstanbul, Turkey
Quad Offline
Senior Expert
Quad  Offline
Senior Expert

Joined: Oct 2007
Posts: 5,210
İstanbul, Turkey
"function" in lite-c defaults to void, your problem might be because of that. Also you need "#define DLL_USE" BEFORE including adll.h


3333333333
Re: Issues setting up plugins [Re: Quad] #433176
11/25/13 21:43
11/25/13 21:43
Joined: Jan 2005
Posts: 330
USA
M
MatAllum Offline OP
Senior Member
MatAllum  Offline OP
Senior Member
M

Joined: Jan 2005
Posts: 330
USA
Using var rather than function in the prototype doesn't change it. DLL_USE is in there:

Code:
#define WIN32_LEAN_AND_MEAN		// Exclude rarely-used stuff from Windows headers
#include <windows.h>
#define DLL_USE	// always define before including adll.h
#include "adll.h"



I don't understand what's going on because I have written plugins for A6 in the past, and they always worked fine.

Edit: Okay, I fixed it. I wasn't doing it quite properly when I originally put the DLL in the game folder. It's fine now.

Last edited by MatAllum; 11/26/13 12:51.

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1