473,405 Members | 2,171 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Two Dlls, Same Namespace, Cast Problem

rob
I have two projects (dlltest, dll2) both creating a dll. The two dlls
define classes (dll1, dll2) within the same namespace (MyNamespace).
One of the dlls (dlltest) is using functionality of the other dll
(dll2). Also both dlls use the same enum (MyEnum) defined in a header
file (common.h). This header file is included in both dlls.

Now I have one function from the first dll (dlltest) return the return
argument from the second dll (dll2). The compiler then complains:

error C2440: 'return' : cannot convert 'MyNamespace::MyEnum' to
'MyNamespace::MyEnum'.

It seems that because the include file is included in both dlls MyEnum
is considered as two different enums even if they reside in the same
namespace. Is this correct? If so then how can it distinguish between
the two if they are called the same? If not then what is the problem.

In any case, what is the proper solution to this? Maybe I could combine
everything in one dll but the functionality of dll2 really can stand on
it's own feet so throwing dlltest into the dll2 does not seem proper.
Also in the actual project there are other dlls that can live
bythemselves but they have some common types. So I am really not sure
how to solve this problem (technically and conceptually). Any ideas are
welcome.

common.h
---------

#ifndef _COMMON_H
#define _COMMON_H
enum class MyEnum{
enum1,
enum2,
enum3
};
#endif

dll2
---
using namespace System;
namespace MyNamespace{
#include "../dlltest/common.h"

public ref class dll2{
public:
static MyEnum ReturnEnumDll2(){
return MyEnum::enum1;
}
};
}

dlltest
------
using namespace System;
#using <dll2.dll>
namespace MyNamespace {
#include "common.h"

public ref class dll1 {
MyEnum ReturnEnumDll1(){
return dll2::ReturnEnumDll2();
}
};
}

Regards,
Rob

Nov 17 '05 #1
0 1377

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Ted Miller | last post by:
Hi folks, I'm looking at moving a large base of C++ code to .Net under tight time constraints. The code runs in mission-critical environments, and I am extremely concerned about the loader lock...
3
by: dhnriverside | last post by:
Hi guys I'm writing a console app in C# for which i want to enable the user to have several "plug-ins". The app has a switch to set the plug-in to use, and at runtime the required dll is loaded...
2
by: rob | last post by:
I have two projects (dlltest, dll2) both creating a dll. The two dlls define classes (dll1, dll2) within the same namespace (MyNamespace). One of the dlls (dlltest) is using functionality of the...
2
by: | last post by:
I try to build dll in VC .NET, In that project I use dlls that were built in VC6, and I get a lot of errors. (for example <iostream.h> instead of <iostream> etc.) I am not aloud to change anything...
14
by: tshad | last post by:
I am trying to set up a reusable library (business component) that I can use in a bunch of my pages. I built the file and it almost compiles, but I am not sure what I am missing. The vbc...
8
by: M. Angelo | last post by:
Situation: An EXE scans the path for DLLs and uses all DLLs and only the existing DLLs All DLLs provides the same functions while doing different processing Program restart is NOT desired ...
5
by: Ecke | last post by:
Hi, i have writte 3 projects, 1 application (.exe) and 2 DLLs. In the application i use the references to add the 2 DLLs to work with their namespaces and functionallity. But the application...
8
by: WebSnozz | last post by:
I have an application written in C that does a lot of low level stuff. It does a lot of things like casting from void*'s. I want to create a new GUI for it in either C# or MC++, but reuse the...
2
by: John Smith | last post by:
Hi All, (I first posted this question on the csharp.general but got no response, and since this NG is more active, so I repost it here) I have two enum definitions from two different...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.