Silverfrost Forums

Welcome to our forums

OK, so I've got two 3rd-party DLLs. One's win32, one's .NET

5 Aug 2011 8:00 #8738

And I'd like to link to both of them from the same .exe!

I've compiled my FTN95 code in .NET and tested that it can call the 3rd-party .NET DLL - OK.

But when I try to link mydotnet.dll against the 3rd-party win32.DLL using the /R:win32.dll command, I get an error window:

dbk_link2.exe - Bad Image 'The application or DLL mydotnet.DLL is not a valid Windows image, please check this against your installation diskette'

Am I trying to do something illegal or is there a trick?

I'm a bit new to .NET stuff (as my recent posts will attest!) but it seems that it should be possible at some level to link a .NET DLL to a Win32 DLL - surely that's what the OS does somewhere along the line?

K

5 Aug 2011 1:03 #8741

You will not be able to link directly in this way and there is no documented way to do this kind of linking.

In theory you can link with both types of dll and this happens when FTN95 uses salflibc.dll under .NET but this usage is not supported and, off hand I don't know how to do it.

5 Aug 2011 2:33 #8742

OK, thanks. Saves me chasing rainbows!

Do you happen to know if .NET/win32 DLL interfacing is possible in the c++ world? In other words, if:

'FTN95.NET exe' calling 'FTN95.NET dll' calling 'c++ win32 dll' won't work,

will

'FTN95.NET exe' calling 'FTN95.NET dll' calling 'c++ .NET dll' calling 'c++ win32 dll' work?

K

6 Aug 2011 6:02 #8743

The password is 'pinvoke'. Type this into Google and enjoy.

8 Aug 2011 1:55 #8751

In C# you can use DLL-imports like [DllImport('my.dll', EntryPoint = 'my_function', ExactSpelling = true)] internal extern static void my_function(StringBuilder name, ref int id);

(search for 'calling unmanaged code' and similar). Don't know if this is what you're looking for though.

Please login to reply.