Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
0 registered members (), 984 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
LucasJoshua, Baklazhan, Hanky27, firatv, wandaluciaia
19053 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
dll_open and c-Lite #176048
01/02/08 17:13
01/02/08 17:13
Joined: Oct 2002
Posts: 4,753
Munich, Bavaria, South of Germ...
TripleX Offline OP
Expert
TripleX  Offline OP
Expert

Joined: Oct 2002
Posts: 4,753
Munich, Bavaria, South of Germ...
Hey,

C-Lite gives out and windows error message (program must be terminated..) if I want to use a function out of an DLL, I opened via dll_open.

Example:

Code:

long GEdit_fileexist(STRING* GEditfile); //dllfunction for checking the existence of a GameEdit-File

function GameEdit_init_startup()
{
str_cpy(material_helpstr1,material_data_folder);
str_cat(material_helpstr1,"\\map-editor\\GameEdit_Small.dll"); //CORRECT PATH
GEdit_tmp_dll = dll_open(material_helpstr1); //NOT 0!!!
str_for_num(GEdit_helpstr1,GEdit_tmp_dll);
diag(GEdit_helpstr1);
diag(material_helpstr1); //checked.. :)

str_cpy(material_helpstr1,"hallo");
GEdit_fileexist(material_helpstr1); //CRASH!
}



Copying the DLL into the acknex_plugins folder and starting the function afterwards works perfectly (with exactly the same code).

Code:

long GEdit_fileexist(STRING* GEditfile); //dllfunction for checking the existence of a GameEdit-File

function GameEdit_init_startup()
{
str_cpy(material_helpstr1,"hallo");
GEdit_fileexist(material_helpstr1); //WORKS
}



Bug or any fault on my side?

Thanks for checking,
Timo Stark

Re: dll_open and c-Lite [Re: TripleX] #176049
01/02/08 21:14
01/02/08 21:14
Joined: Sep 2003
Posts: 9,859
F
FBL Offline
Senior Expert
FBL  Offline
Senior Expert
F

Joined: Sep 2003
Posts: 9,859
You need to add a .wdl file with the name of your main c file and specify plugindir.

Re: dll_open and c-Lite [Re: FBL] #176050
01/03/08 11:36
01/03/08 11:36
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
You don't need a WDL file, but you need to give the path to the DLL in the dll_open command.

However, dll_open should return NULL when the DLL is not found. Maybe there was a different version of that DLL in the work folder?

Re: dll_open and c-Lite [Re: jcl] #176051
01/03/08 12:35
01/03/08 12:35
Joined: Sep 2003
Posts: 9,859
F
FBL Offline
Senior Expert
FBL  Offline
Senior Expert
F

Joined: Sep 2003
Posts: 9,859
No, the DLL is directly in the project folder. So I need a WDL file with plugindir ".";

Otherwise A7 crashes.

Re: dll_open and c-Lite [Re: FBL] #176052
01/03/08 12:51
01/03/08 12:51
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
plugindir has no effect on dll_open. So your WDL file will also crash.

http://manual.conitec.net/adll_open.htm

Calling a nonexistent function, such as a function from a not found DLL, will cause a crash.

Re: dll_open and c-Lite [Re: jcl] #176053
01/03/08 13:40
01/03/08 13:40
Joined: Sep 2003
Posts: 9,859
F
FBL Offline
Senior Expert
FBL  Offline
Senior Expert
F

Joined: Sep 2003
Posts: 9,859
All I have to do is renaming the WDL, and everyhting crashes. With the WDL, it runs perfectly fine.

I tested this with multiple projects and assumed it was the standard way to use.

My dllopen call:
STRING* dll_str = "ackwii.dll"; //name of dll (should be ackwii.dll)
wii_handle_n = dll_open(dll_str);

DLL is located in project directory.

Well I can live with having a WDL file...

Re: dll_open and c-Lite [Re: FBL] #176054
01/04/08 14:53
01/04/08 14:53
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
Does it change anything when you don't open the dll at all?

Re: dll_open and c-Lite [Re: jcl] #176055
01/04/08 19:16
01/04/08 19:16
Joined: Sep 2003
Posts: 9,859
F
FBL Offline
Senior Expert
FBL  Offline
Senior Expert
F

Joined: Sep 2003
Posts: 9,859
The project runs fine without DLL open (surprisingly).

If I rename/delete the WDL file with plugindir "."; inside, it still crashes.

Re: dll_open and c-Lite [Re: FBL] #176056
01/05/08 10:54
01/05/08 10:54
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
That's not surprising, but logical from what you said - so forget your WDL file for the moment. It has no effect on dll_open, it just changed your PLUGINDIR folder and thus gave you the illusion that dll_open worked.

We need to find why dll_open() appears not to work properly for your DLL. This seems to be a similar problem that TripleX was reporting.

If you want to test this, please remove your WDL file so that it does not interfere, and move the DLL into a subfolder "dll" to your project. Now open the DLL this way:

wii_handle_n = dll_open("dll\\ackwii.dll");

Please check a) if wii_handle_n is nonzero and b) if the DLL works.

On a side note - I see that you're developing a Wii remote dll, which is just what we also planned for the next update. Can you contact me on this? Maybe we can cooperate and save each other some work, or we can just use your code.

Re: dll_open and c-Lite [Re: jcl] #176057
01/05/08 13:41
01/05/08 13:41
Joined: Sep 2003
Posts: 9,859
F
FBL Offline
Senior Expert
FBL  Offline
Senior Expert
F

Joined: Sep 2003
Posts: 9,859
I've tried that. The game still crashes, regardless whether I try wii_handle_n = dll_open("dll\\ackwii.dll"); and put the dll into a DLL subfolder or I use wii_handle_n = dll_open(".\\ackwii.dll");

However I noticed that the handle is set correctly, even without WDL file. So it must be some other function relying on plugindir. I'm not doing much else interesting than calling functions directly from the DLL.
Only using a WDL file fixes this for me.



As to the Wiimote DLL I'm using some old public domain C++ source which is no longer maintained, so I started fixing bugs and implementing proper IR support on my own. Things work pretty well now - only supporting the Classic Controller will need some rewrite of poorly designed functions from the original code. I wanted to work on this after January when exams are finished.

Last edited by Firoball; 01/06/08 01:57.
Page 1 of 2 1 2

Moderated by  jcl, Nems, Spirit, Tobias 

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