.Net Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - More.Net Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 22nd, 2002, 01:22 AM
Sulik Sulik is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Posts: 10 Sulik User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Using MFC amd .NET dlls in a single project

I have 2 dlls - one build with a MFC support an dthe other is fully managed .NET dll.
Both of them incapsulate a class CBString - in MFC it is something like SCtring, in .NET - like String.

I want to create a project that will be able to use any version of this class by user choice. The idea is to create a single code for using both dll versions.

I created a .h file that will do the choosing.

the code is something like:

#ifdef _MFC_

#pragma unmanaged
#include <.h file declaring my CBString class>

#else

#pragma managed
#using "<the .dll file built with .NET>"
using namespase CBString;

#endif

So, if i write
#define _MFC_
in my code, the .h file will #include my MFC .h file
if i won't - it will be #using namespace and .NET dll

The problems are:

1) I have to include the MFC dll manually in the Project options->Linker->Additional Dependences.

2) I have to use /clr compiler option OR create a Managed Application to use the .NET dll

What I actually want is
Ability to swith between MFC AND .NET dlls using my CODE ONLY. No manual action will do, even no /clr compiler options, not to tell about Project Options settings.

I know there must be a way to do this, but I am completely unable to figure it. That's why I'm looking forward to your help.

Great THANKS in advance.

Reply With Quote
  #2  
Old November 22nd, 2002, 04:11 AM
TechNoFear TechNoFear is offline
Offensive Member
Dev Shed Novice (500 - 999 posts)
 
Join Date: Oct 2002
Location: in the perfect world
Posts: 594 TechNoFear User rank is Sergeant (500 - 2000 Reputation Level)TechNoFear User rank is Sergeant (500 - 2000 Reputation Level)TechNoFear User rank is Sergeant (500 - 2000 Reputation Level)TechNoFear User rank is Sergeant (500 - 2000 Reputation Level)TechNoFear User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 2 Days 14 h 6 m 15 sec
Reputation Power: 22
Did you make the DLL's?

Have you looked at explicit linking (with LoadLibrary() and GetProcAddress() ) as opposed to the implicit link with the .lib (created when you create the DLL).


(I have not used .NET with DLL's but use WIN32 DLL's explicitly linked and loaded at run time)
__________________
The essence of Christianity is told us in the Garden of Eden history. The fruit that was forbidden was on the Tree of Knowledge. The subtext is, All the suffering you have is because you wanted to find out what was going on. You could be in the Garden of Eden if you had just kept your f***ing mouth shut and hadn't asked any questions.

Frank Zappa

Reply With Quote
  #3  
Old November 22nd, 2002, 05:44 AM
Sulik Sulik is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Posts: 10 Sulik User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Well

What I need is to include my class along with all of it's methods and members. I need it to be a part of my code, want to be able to use it as if it was declared inside of my project.
As far as Iknow exolicit linking will require a declaring the pointers to the dll functions. This is not acceptable.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - More.Net Development > Using MFC amd .NET dlls in a single project


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT