View previous topic :: View next topic |
Author |
Message |
KennyT
Joined: 02 Aug 2005 Posts: 320
|
Posted: Fri Aug 05, 2011 9:00 am Post subject: OK, so I've got two 3rd-party DLLs. One's win32, one's .NET |
|
|
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 |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8257 Location: Salford, UK
|
Posted: Fri Aug 05, 2011 2:03 pm Post subject: |
|
|
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. |
|
Back to top |
|
 |
KennyT
Joined: 02 Aug 2005 Posts: 320
|
Posted: Fri Aug 05, 2011 3:33 pm Post subject: |
|
|
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 |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8257 Location: Salford, UK
|
Posted: Sat Aug 06, 2011 7:02 am Post subject: |
|
|
The password is "pinvoke". Type this into Google and enjoy. |
|
Back to top |
|
 |
Sebastian
Joined: 20 Feb 2008 Posts: 177
|
Posted: Mon Aug 08, 2011 2:55 pm Post subject: |
|
|
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. |
|
Back to top |
|
 |
|