CodefoundryDE / LegacyWrapper

LegacyWrapper uses a x86 wrapper to call legacy dlls from a 64 bit process (or vice versa).
MIT License
79 stars 20 forks source link

DLLs contain method names that are incompatible with version 3.0.0 + (EntryPointNotFoundException) #32

Open browloga490 opened 3 years ago

browloga490 commented 3 years ago

Hi,

I noticed that to reference a method within a DLL, I would have to create an interface that contained a method with the same name as the method in the DLL. This has worked out perfectly for the majority of my DLLs, but no so great for one of them that has entry point names like "_initEth488@4". I believe the "@4" part is causing the problem - I can't create a method with the name "_initEth488@4" due to formatting issues. When I tried to create a method with the name "_initEth488" I received the error:

EntryPointNotFoundException: Unable to find an entry point named '_initEth488' in DLL [DLL PATH]

I noticed that in previous versions (I tried to use versions 2.1.0, 2.0.1, and 2.0.0) it was required to input the name of the DLL method as a string. This would allow for me to use methods like "_initEth488@4", but unfortunately I ran into a strange bug that caused my app to freeze when it got to the line:

using (var client = new WrapperClient([DLL PATH], TargetArchitecture.X86))

This wrapper seems like it would be the perfect, simple solution to my problem if I could get it working. Any help would be greatly appreciated.

Thanks!

zalintyre commented 3 years ago

Hello,

you could maybe create a pull request to legacy wrapper where you can override the method's name via an attribute on the interface method?

Kind regards Franz