Results 1 to 7 of 7
-
01-30-2015, 11:49 AM #1
- Join Date
- Nov 2010
- Location
- Austria
- Posts
- 34
Writing my DLL, API parameter passing problem
Hi Jean Luc !
I have a small problem with the API, in my dll.
when i want to pass a switch event, calling back the switch routine, i get an error message from hardware connect. "there was an error.... in FastTimer"
Maybe i do not have a correct entry point for the switch routine. But i think not. The message comes from your Hardare Connect routine, I guess.
Probably there are invalid parameters passed. I realized this in C++ (visual studio) All seems to work fine with hardware connect, except this.
I think it could be a question of parameter transfer, maybe there is a different notation for Pascal necessary?
at startup I get the procedure address as documented with:
SW_PROC = proc;
then i call SW_PROC inside the fastTimer routine as below:
int __stdcall FastTimer(void)
{
int inptCodeNr;
int inptValue;
int inptType;
devicelib::funcs::USB_Poll(&inptType, &inptCodeNr, &inptValue);
if (inCodeNr)
{
// got new data
if (inptType==MOD_DIGITAL)
{
// send data to switch input routine
SW_PROC(inCodeNr,inValue); // <----- here is the problem
}
}
}
Question: is the 'int' parameter in this case expected as signed or as unsigned?
So this is C++, maybe Pascal expects parameter passing in a different way.....
Also tried to pass constants, same effect.
any idea?
Guenther
http://a320.at
-
01-31-2015, 11:11 AM #2
- Join Date
- Mar 2008
- Location
- France,Nice
- Posts
- 2,652
Re: Writing my DLL, API parameter passing problem
Hi,
The SW_PROC parameter are signed 32bits integers.
The message you get could mean that your fastimer procedure is taking too much time to run, and causes a crash when the next cycle arrives. This could mean it is a better idea to call the SW_PROC out of the fasttimer procedure, and use only the fasttimer for timing references.
Also, make sure the SW_PROC is using stdcall declaration convention.
JL
-
02-03-2015, 04:48 PM #3
- Join Date
- Nov 2010
- Location
- Austria
- Posts
- 34
Re: Writing my DLL, API parameter passing problem
thanks a lot Jena Luc!
Solved it. I am running an extra worker thread now, just for polling USB devices and all is runnig fine.
Just one more small question: I exprienced that the "Start" procedure is called from Hardware Connect only when I click "reset hardware" before. Should'nt it do this at startup automatically? I am running the Hardware Connect module only right now fo testing, no FSX and other modules running. Will it be triggered when te modules are loading?
thanx a lot!
-
02-03-2015, 06:06 PM #4
- Join Date
- Mar 2008
- Location
- France,Nice
- Posts
- 2,652
Re: Writing my DLL, API parameter passing problem
Yes, it is loaded once the software is running (I think at least FSX, server, FSXconnect and OVHD).
JL
-
02-03-2015, 06:35 PM #5
- Join Date
- Nov 2010
- Location
- Austria
- Posts
- 34
Re: Writing my DLL, API parameter passing problem
very good. thanks.
Just for your information, I just saw, that each click on the reset hardware button loads another copy of the dll. There is no unload I guess.
So far no problem fo me.
Gü.
-
02-03-2015, 08:10 PM #6
- Join Date
- Mar 2008
- Location
- France,Nice
- Posts
- 2,652
Re: Writing my DLL, API parameter passing problem
i have to look at that, probably a little bug on my side...
JL
-
02-04-2015, 03:26 AM #7
- Join Date
- Nov 2010
- Location
- Austria
- Posts
- 34
Re: Writing my DLL, API parameter passing problem
...no stress
it's a minor issue, there are certainly other things to do.
just for your bug list.
Girls in your town
A320 Sound Files Missing