473,395 Members | 1,790 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,395 software developers and data experts.

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 1228
On 30 Jun 2006 01:46:35 -0700, am********@yahoo.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_CLASS 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(dllexport)
#else
#define X_EXPORT __declspec(dllimport)
#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
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_...
1
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...
193
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...
3
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...
3
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...
8
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...
1
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
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...
4
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?...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
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,...

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.