Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by EternallyCurious. 04/18/24 10:45
StartWeek not working as it should
by Zheka. 04/18/24 10:11
folder management functions
by VoroneTZ. 04/17/24 06:52
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
zorro 64bit command line support
by 7th_zorro. 04/15/24 09:36
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:48
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 552 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, 11honza11, ccorrea, sakolin, rajesh7827
19046 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
plugin SDK - liteC migration - sticky! #106976
01/15/07 14:55
01/15/07 14:55
Joined: Jul 2001
Posts: 6,904
H
HeelX Offline OP
Senior Expert
HeelX  Offline OP
Senior Expert
H

Joined: Jul 2001
Posts: 6,904
We should begin a new list of things a developer should take care of when he is developing engine plugins accessed via liteC (even it is not out yet, but I assume that most C++ plugin developers have access to the liteC beta).

I will begin with "how to pass vectors to a DLL" because its a bit different now than with cscript and I got some headaches since yesterday night

Code:

//liteC:

//call:

VECTOR* testVector [3];

testVector[0] = 15;
testVector[1] = 2009;
testVector[2] = 666;

dllTest(testVector);

//prototype:
void dllTest(VECTOR* position);

//C++

//DLL function
DLLFUNC void dllTest (VECTOR* position)
{
char buffer [50];
int n;
n = (int)position->y;
n=sprintf (buffer, "%d", n);
error(buffer);
}



Please post other snippets here and NO posts like "yay thats a cool idea - but I dont have a clue about that topic".

Thank you.

Re: plugin SDK - liteC migration - sticky! [Re: HeelX] #106977
04/15/07 07:59
04/15/07 07:59
Joined: Mar 2007
Posts: 75
Hamburg, Ger
Altimeter Offline
Junior Member
Altimeter  Offline
Junior Member

Joined: Mar 2007
Posts: 75
Hamburg, Ger
OK, I see.
Any special things to observe, when I want to pass the vector back to liteC?
Lets say, C++ dll changed the vector to 16,2010,667 and now I want to pass these values back to liteC's testVector[3]?

Re: plugin SDK - liteC migration - sticky! [Re: Altimeter] #106978
02/19/08 10:46
02/19/08 10:46
Joined: Apr 2006
Posts: 136
San Francisco
T
Tor Offline
Member
Tor  Offline
Member
T

Joined: Apr 2006
Posts: 136
San Francisco

Code:

//C++

//DLL function
DLLFUNC void dllTest (VECTOR* position)
{
char buffer [50];
int n;
n = (int)position->y;
n=sprintf (buffer, "%d", n);
error(buffer);
}



Please keep in mind that all a6/a7 objects are fixed point vars (21.10's I think, with a sign bit, I know for a fact int of 1024 = var 1.0 in engine). So it's best to convert them over in case you do any multiplication etc.


"Towlie, you're the worst character ever." I know...
Re: plugin SDK - liteC migration - sticky! [Re: Tor] #304260
01/06/10 05:28
01/06/10 05:28
Joined: Dec 2009
Posts: 128
China
frankjiang Offline
Member
frankjiang  Offline
Member

Joined: Dec 2009
Posts: 128
China
i study for "3dgs7\sdk_plugin\sampledll.cpp",but i have a question,
and then build by vs2005,at last i get "sampledll.dll".
and i can used sampledll.wdl to call sampledll`s function,but ): I can`t used sampledll.c to call sampledll`s function.

this is a part of sampledll.cpp
//---------------------------------------------------------
///////////////////////////////////////////////////////////////////////
// Use this source as template for your own DLLs.
// Copy sampledll.dll to the acknex_plugins folder,
// and include "sampledll.wdl" into your script.
///////////////////////////////////////////////////////////////////////
//---------------------------------------------------------

is that mean we can`t call dll`s function by lite-C??

can you tell me?


development 3d game is interesting!
Re: plugin SDK - liteC migration - sticky! [Re: frankjiang] #304267
01/06/10 08:24
01/06/10 08:24
Joined: Dec 2006
Posts: 1,086
Queensland - Australia
Nidhogg Offline
Serious User
Nidhogg  Offline
Serious User

Joined: Dec 2006
Posts: 1,086
Queensland - Australia
Plugins should load automaticly in lite-c when in A7's plugin folder.
You then can use Prototypes to initilize plugins functions.
eg: function init_blah();

When you publish your project the plugin needs to be in the exe folder.


Windows XP SP3
Intel Dual Core CPU: E5200 @ 2.5GHz
4.00GB DDR3 Ram
ASUS P5G41T-M LX
PCIE x16 GeForce GTS 450 1Gb
SB Audigy 4
Spyware Doctor with AntiVirus
Re: plugin SDK - liteC migration - sticky! [Re: Nidhogg] #304371
01/07/10 08:06
01/07/10 08:06
Joined: Dec 2009
Posts: 128
China
frankjiang Offline
Member
frankjiang  Offline
Member

Joined: Dec 2009
Posts: 128
China
thank you ^_^


development 3d game is interesting!
Re: plugin SDK - liteC migration - sticky! [Re: frankjiang] #304651
01/09/10 17:01
01/09/10 17:01
Joined: Dec 2009
Posts: 128
China
frankjiang Offline
Member
frankjiang  Offline
Member

Joined: Dec 2009
Posts: 128
China
i have question for call my dll`s function
C++
i build it and put to "3dgs7\acknex_plugins\sample.dll"
---------------------------------------------------------------
---------------------------------------------------------------
# pragma warning (disable:4312)
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <tchar.h>
#include <math.h.>
#define DLL_USE
#include "adll.h"
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved )
{
engine_bind();
return TRUE;
}
DLLFUNC var my_square(var x)
{
return ( _VAR( _FLOAT(x) * _FLOAT(x) + 1 ));
}
-------------------------------------------------------------------------
-------------------------------------------------------------------------
lite-C: sampledll.c by Script Editor

// lite-C header for sampledll.dll

function my_square(x);
#include <acknex.h>
#include <default.c>
STRING* str_msg = "sampledll.c";
TEXT* txt_1 =
{
pos_y=10;
string(str_msg);
flags = SHOW;
}
void main()
{
str_for_num(str_msg,my_square(3));
}
-------------------------------------------------------------------------
-------------------------------------------------------------------------


and then i run sampledll.c ,but i get a error file!
(ackerr.txt)
----------------------------------------------------------
Error in 'MAIN' line 3: 'function' undeclared identifier
<function my_square(x);>
----------------------------------------------------------

help me ! guys


development 3d game is interesting!
Re: plugin SDK - liteC migration - sticky! [Re: frankjiang] #304722
01/10/10 12:08
01/10/10 12:08
Joined: Dec 2006
Posts: 1,086
Queensland - Australia
Nidhogg Offline
Serious User
Nidhogg  Offline
Serious User

Joined: Dec 2006
Posts: 1,086
Queensland - Australia
Please do not post your questions in this thread as this thread is only for usefull examples/code.

Start a new thread with your problem.


Windows XP SP3
Intel Dual Core CPU: E5200 @ 2.5GHz
4.00GB DDR3 Ram
ASUS P5G41T-M LX
PCIE x16 GeForce GTS 450 1Gb
SB Audigy 4
Spyware Doctor with AntiVirus

Moderated by  TWO 

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