Results 1 to 7 of 7
  1. #1
    25+ Posting Member
    Join Date
    Nov 2010
    Location
    Austria
    Posts
    34
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    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

  2. #2
    2000+ Poster - Never Leaves the Sim
    Join Date
    Mar 2008
    Location
    France,Nice
    Posts
    2,424
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    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

  3. #3
    25+ Posting Member
    Join Date
    Nov 2010
    Location
    Austria
    Posts
    34
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    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!

  4. #4
    2000+ Poster - Never Leaves the Sim
    Join Date
    Mar 2008
    Location
    France,Nice
    Posts
    2,424
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    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

  5. #5
    25+ Posting Member
    Join Date
    Nov 2010
    Location
    Austria
    Posts
    34
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    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Ł.

  6. #6
    2000+ Poster - Never Leaves the Sim
    Join Date
    Mar 2008
    Location
    France,Nice
    Posts
    2,424
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Writing my DLL, API parameter passing problem

    i have to look at that, probably a little bug on my side...

    JL

  7. #7
    25+ Posting Member
    Join Date
    Nov 2010
    Location
    Austria
    Posts
    34
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    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.