Jump to content
LaunchBox Community Forums

"Bad IL error" on 3rd party dlls


Recommended Posts

Hi folks, 

I'm authoring some LED Controller functions into my swiss army knife plugin given LEDBlinky doesn't really cut the mustard for me. I have cloned Ben Baker's excellent PacDriveSDK from here:

https://github.com/benbaker76/PacDriveSDK

The repo works fine on my PC and I can use the cpp driver dlls () without any issue on the test applications. 

However, Launchbox doesn't seem to like them at all. I get the following errors during the Plugin Initialisation phase:

Screenshot2025-01-04144644.png.db79ffbb97a98f06ddbdc03643892178.pngScreenshot2025-01-04144635.png.2359cb4dbe1a584e5e34c8e01843eb11.png

I've tried just putting them in the plugins folder without my plugin files and I still get the same errors - implying it's Launchbox not liking the dlls rather than my plugin. I also couldn't get any other exception details, even after putting LB into debug mode (there were no logs in the log folder, maybe because once those exceptions are thrown, LB doesn't boot)

I have emailed Ben Baker, but he may say it's a Launchbox issue - so hoping I don't get caught between a rock and a hard place on this one. My skills don't extend to cpp, so I have no idea what the compatibility issues are. 

Do hope someone can help or clarify what's happening here, as totally stuck with this one!

Link to comment
Share on other sites

Solved

With the awesome-as-ever help of @JoeViking245, found a work-around. Posted here for posterity/others in the same boat. 

I had to move these two dll's to a location outside of the plugin's folder. So, I moved them to:

[LaunchboxRoot]/ThirdParty/Gearbox

I then had to update all of my DllImport statements to a new path relative to my Plugin's directory @ [LaunchboxRoot]/PLugins/Gearbox. E.g:

[DllImport("../../ThirdParty/Gearbox/PacDrive32.dll", EntryPoint = "PacSetCallbacks", CallingConvention = CallingConvention.StdCall)]
private static extern void PacSetCallbacks32(USBDEVICE_ATTACHED_CALLBACK usbDeviceAttachedCallback, USBDEVICE_REMOVED_CALLBACK usbDeviceRemovedCallback);

Thanks again, JoePluginKing!

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...