How to Mix .NET library with MFC Application ????

  • Thread starter Thread starter Skandaja
  • Start date Start date
S

Skandaja

Hi All,
I have created a classic MFC Dialog application ( statically linked
to MFC Library) which can run on any windows platform, without any
library dependencies.

Now, In this application I want to use .NET library say I want to use
sockets provided by .Net

using namespace System::Net::Sockets;

TcpClient* tl = new TcpClient("192.168.0.241",9001);
NetworkStream* nw = tl->GetStream();

bla.. bla...

I want to make a static link to the .Net libraries, so that my
application can run on any Windows platform, without any library
dependencies.

Is there any way I can acheive this??

Thanks for your earliest attention.

Regards,
Manjesh
 
There is no static version of .NET.
Always need your users to install the .NET FrameWork.
Though .NET is nice I doubth it it worth the problems introducing .NET just
for socket support.

Cheers
Ditlef
 
Skandaja said:
I have created a classic MFC Dialog application ( statically linked
to MFC Library) which can run on any windows platform, without any
library dependencies.

Now, In this application I want to use .NET library say I want to use
sockets provided by .Net

using namespace System::Net::Sockets;

TcpClient* tl = new TcpClient("192.168.0.241",9001);
NetworkStream* nw = tl->GetStream();

bla.. bla...

I want to make a static link to the .Net libraries, so that my
application can run on any Windows platform, without any library
dependencies.

Is there any way I can acheive this??

That's not the way .Net was intended to be used and there is no support from
MS for doing that. There are a couple of third party products which purport
to be able to do that. This is one

http://www.remotesoft.com/linker/

about which by the way, I know nothing.

Frankly, your approach seems a high price to pay for socket support.

Regards,
Will
 
In addition to that, you will not be able to use the static MFC any more if
you are moving to CPPCLI.

In CPPCLI object files created with /clr, /clr:pure, or /clr:safe always
depend on the DLL version of the CRT: Only /MD and /MDd is allowed - /MT and
/MTd are explicitly disallowed. If you are using the DLL version of the CRT,
you must use the DLL version of MFC, too.

Static linking could give you on-file-copy deployment - that's why I liked
this option, too. But with runtime environments like .NET, this dream is
over anyway and since MFC is deployed in WinSxS at least most versioning
problems are solved.

Marcus
 
Back
Top