473,569 Members | 2,704 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Some classes are not exported from MFC extension DLL

Hi

I am migrating a product code (originally written in VS2003) to VS2005.
The application is written in VC++ (using MFC) and has mix of managed
and unmanaged classes. It is a desktop based application which controls
an instrument (a device) and interacts with it.

I fixed all the compiler errors and ran the application. I got a
message that "The procedure entry point XXX could not be located in the
dynamic link library AAAA.dll.

Upon using Dependency Walker, I realised that there are at least 5
classes which are not exported from one of the DLLs. (Rest all DLLs are
good). However, inside the code, the classes exported well using
AFX_EXT_CLASS macro before the class name. There are two points to note
here.
1) When the same code was copied as is, compiled and ran on another PC
in a different country (on VS2005), it ran well.
2) The DLL in question here is the one which interacts with the actual
instrument (device) using some third party DLLs.

I am not getting into any good direction. Can anyone guess what may be
happenning? Since the application ran well on some other machine, I
feel the code is ok. It has something to do with some configuration
setting. Can anyone guess?

Thanks in advance.

Amit Dedhia

Jun 30 '06 #1
1 1235
On 30 Jun 2006 01:46:35 -0700, am********@yaho o.com wrote:
Hi

I am migrating a product code (originally written in VS2003) to VS2005.
The application is written in VC++ (using MFC) and has mix of managed
and unmanaged classes. It is a desktop based application which controls
an instrument (a device) and interacts with it.

I fixed all the compiler errors and ran the application. I got a
message that "The procedure entry point XXX could not be located in the
dynamic link library AAAA.dll.

Upon using Dependency Walker, I realised that there are at least 5
classes which are not exported from one of the DLLs. (Rest all DLLs are
good). However, inside the code, the classes exported well using
AFX_EXT_CLAS S macro before the class name.
If Dependency Walker reveals the classes weren't exported, how is it they
"exported well inside the code"?
There are two points to note
here.
1) When the same code was copied as is, compiled and ran on another PC
in a different country (on VS2005), it ran well.
2) The DLL in question here is the one which interacts with the actual
instrument (device) using some third party DLLs.

I am not getting into any good direction. Can anyone guess what may be
happenning? Since the application ran well on some other machine, I
feel the code is ok. It has something to do with some configuration
setting. Can anyone guess?


The AFX_EXT_CLASS macro should be avoided, because it cannot be used in
multiple DLL scenarios, where one extension DLL uses another. Try replacing
your AFX_EXT_CLASS usage as follows:

In some DLL header file, which the other DLL headers #include, write the
following, replacing "X" with the name of your DLL, making sure it has a
reasonable chance of being unique:

#ifdef COMPILING_X_DLL
#define X_EXPORT __declspec(dlle xport)
#else
#define X_EXPORT __declspec(dlli mport)
#endif

Then #define COMPILING_X_DLL only in that DLL's project. This method can be
used by multiple DLLs, a big advantage over AFX_EXT_CLASS, and since the
macro names are unique, they don't conflict. Then you can do things like:

X_EXPORT void f();

class X_EXPORT MyClass
{
...
};

Look in the project's preprocessor options, and you may find the AppWizard
has already defined a suitable COMPILING_X_DLL macro for you.

--
Doug Harrison
Visual C++ MVP
Jun 30 '06 #2

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

Similar topics

2
3312
by: Steve | last post by:
Hi. I've got an exported database from an external system. It's in the format of MYI, MYD and frm extension files. However, one table in this database has book.frm, book.MYD, book.MYI _AND_ book.TMD. When I've created a database in phpmyadmin/mysql, moved all the files into the proper directory, every table can be looked at and selected but...
1
6253
by: Vijai Kalyan | last post by:
I am not sure if this OT, but I will go ahead and post. If it has to be posted elsewhere let me know. -vijai. ------ I have a class declared as follows: #pragma once // a simple reference counter implementation
193
9444
by: Michael B. | last post by:
I was just thinking about this, specifically wondering if there's any features that the C specification currently lacks, and which may be included in some future standardization. Of course, I speak only of features in the spirit of C; something like object-orientation, though a nice feature, does not belong in C. Something like being able...
3
1165
by: Mark | last post by:
I've been writing code in VB and VBScript for several years and I'm finally caving in to .net! I've decided to work with C# as I've always understood the basic concepts of C/C++ but never gained much experience in writing actual code. I'm trying to work out the best way to implement a class to meet the following requirements. I have...
3
4188
by: Bob Rock | last post by:
Hello, in the last few days I've made my first few attempts at creating mixed C++ managed-unmanaged assemblies and looking aftwerwards with ILDASM at what is visible in those assemblies from a managed point-of-view I've noticed that: 1) for each managed and unmanaged C function (not C++ classes) I get a public managed static method...
8
1586
by: Alfonso Morra | last post by:
I am familiar with creating lean and mean WIN32 DLLS and exporting C functions via a DEF file (or cconv decorators), but I am wndering how I can export my C++ objects from my DLLs? Ideally, I would be able to use the classes (and their methods) by calling the objects and invoking their methods - is this possible, given the fact that the C++...
1
1278
by: Alfonso Morra | last post by:
I have a class declared as ff: class __declspec(dllexport) A { public: A() ; A(const A&) A& operator=(const A&) ; ~A() ; void doThis(void) ;
10
1560
by: Bit byte | last post by:
I have a set of C++ classes for which I want to provide a C API - and compile into a C DLL, for use in an application that can only work with a C interface DLL. Any suggestions/pointers on how to proceed. Googling is not bringng anything up that directly addresses the issue (parashift info is useful, but does not deal specifically, with the...
4
3301
by: Rene | last post by:
Hi, I was wondering if anyone could tell me why extension methods must be declared on static classes. I mean, why not allowing them to be declared as static methods in regular instance classes? In case you are wondering, I am only curious to find out the reason for this limitation. I don't really have a need to declare extension method on...
0
7698
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7612
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8122
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
6284
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5219
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3653
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3640
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
937
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.