Usermode DLL and API



  • Originally posted by DarKcyde


    Seems you've decided to go with a static library. Guess I'll be the first to request a DLL again.

    I've implemented a working ViGEm solution in Thrustmaster TARGET script (for TM joysticks). It uses an interpreted C syntax, but it's not compiled, nor a full C implementation. Crucially, it does have Loadlibrary() which allowed me to use ViGEmUM.dll just fine. Because it's not compiled, I have no way to link a .lib to the script.

    I would think that other script based languages would have an easier time loading a DLL. In particular I'm thinking of Autohotkey. I know it has very good DLL loading abilities, but I don't know if it could use a static library.

    About the API, the limited C syntax I'm stuck with doesn't have the ability to pass a struct as a parameter to a function. I can pass the address of a struct though, so pointer params are just fine. I had to modify the gamepad update function in the DLL to take pointers only. The new API seems to have changed nearly all params to pointers, except the vigem_target_x360_update() requires a XUSB_REPORT struct still. If that was a pointer, I wouldn't have to fiddle with anything.

    I've seen a working winsock (dll) implementation using Target script, and that used pointers wherever a struct was passed. Perhaps pointers are standard practice for passing structs to DLLs? I dunno, I'm a hobbyist coder at best... way beyond my pay grade.



  • Originally posted by nefarius


    Counter-question: is it really necessary for you to use the scripting environment you're using to meet your goal?

    I can add a build configuration for a DLL for the project, sure. My main motivation for preferring a static library is simple: most of the developers which use it in native C/C++ did static compilation anyways and since the footprint is really small and version collisions are much more prone with DLLs that's why I did what I did.



  • Originally posted by DarKcyde


    There are no alternatives that provide the abilities that Target does. Besides complex C programming for macros, it handles HID device hiding, virtual joystick driver, and LED control of TM devices. Joystick Gremlin is the closest generic solution I think. Still no where near the abilities of the TM solution. Really the only major drawback of Target is it only works with TM devices, which isn't a problem for us folks who own those devices.


Log in to reply