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

Example #37

Open keithbaenre opened 3 years ago

keithbaenre commented 3 years ago

I am new to Windows and DLL's. I have an old 32 bit DLL written in Visual Studio 6 c++. I need to make a 64 bit version. I want to use the Legacy Wrapper 3.01 but do not understand where to start or how to do it.

Can someone provide a complete example or instructions?

Thank you in advance.

zalintyre commented 3 years ago

Hello,

LegacyWrapper does not create a DLL for you. You can use it to call old 32bit DLLs when there's no way for you to create a 64bit DLL on your own.

Kind regards Franz

keithbaenre commented 3 years ago

Thank you Franz,

Is there an example?

I have a 32bit DLL.  So is there an example of a program calling LegacyWrapper in order to call the 32bit dLL functions?

Thank you,

Keith

On 01/28/2021 11:22 AM Franz Wimmer <notifications@github.com> wrote:

Hello, LegacyWrapper does not create a DLL for you. You can use it to call old 32bit DLLs when there's no way for you to create a 64bit DLL on your own. Kind regardsFranz —You are receiving this because you authored the thread.Reply to this email directly, view it on GitHub, or unsubscribe.

keithbaenre commented 3 years ago

Hi Franz,

Maybe it would be easier if I just clearly state my exact problem.

I have a dll (FTT.DLL) which is 32 bit.  it has 5 functions.

I need a 64 bit dll exactly the same.

Do I create a 64 bit dll and then implement the 64 bit dll by calling the legacy wrapper?

If so, do I use LegacyWrapper to make the server that sits on top of the 32bit DLL?

If so, is there an example of the server code?

What would be nice for me is an example project that had and old 32 bit DLL and the new 64 bit DLL and a program that calls the 64 bit DLL.  Is there something like that out there.  I have the 8 projects in visual studio 2017 but I am not sure what each project is used for.

Sorry but I am a hardware guy who got assigned this task.

Thank you,

Keith

On 01/28/2021 11:22 AM Franz Wimmer <notifications@github.com> wrote:

Hello, LegacyWrapper does not create a DLL for you. You can use it to call old 32bit DLLs when there's no way for you to create a 64bit DLL on your own. Kind regardsFranz —You are receiving this because you authored the thread.Reply to this email directly, view it on GitHub, or unsubscribe.

zalintyre commented 3 years ago

Hello Keith,

if you have the code of yout DLL, just compile it using the 64bit compiler of Visual Studio. There is no need for using LegacyWrapper at all.

Also if you are lucky, you don't need to change any code of your DLL. Just recompile it.

Kind regards Franz

keithbaenre commented 3 years ago

Hello Franz,

Thank you for your reply.

I have the code but it was written using MFC in Visual Studio c++ 6.0.  It also links in some 32bit DLL's which I do not have the source code (although I don't even know if these libraries are needed).

I tried following an article on microsoft's website to install the Feb 2003 64 bit compiler, but it had me link in some library that did not exist in the distribution so that failed.

I read that visual studio 7.0 supported MFC and thought maybe I could use that, but then I came across your wrapper.

Any suggestions are greatly accepted.

I am willing to build an example to give to you once I figure it out.  But truthfully I just don't know where to even start.

Is this the correct steps:

1) create new 64bit DLL with same methods that calls your legacy wrapper?

2) build a server program that interfaces the legacy wrapper to the original 32bit DLL?

3) Then somehow make the server program run when the new 64bit DLL is opened?

Or is the legacy wrapper already do steps 2 and 3?

thanks,

keith

On 01/28/2021 12:36 PM Franz Wimmer <notifications@github.com> wrote:

Hello Keith, if you have the code of yout DLL, just compile it using the 64bit compiler of Visual Studio. There is no need for using LegacyWrapper at all. Also if you are lucky, you don't need to change any code of your DLL. Just recompile it. Kind regardsFranz —You are receiving this because you authored the thread.Reply to this email directly, view it on GitHub, or unsubscribe.

zalintyre commented 3 years ago

Hello Keith,

in case you cannot modify or recompile your 32bit DLL for whatever reason, LegacyWrapper can help you. Just include the LegacyWrapper dependency in your NuGet configuration and call your 32bit DLL with it (see example in README). This requires your application to be written in C# or VB, C++ is not possible in this case.

Kind regards Franz