473,621 Members | 2,745 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Bizzare error following change of _export to __declspec(dlle xport)

Hi,

Sorry for my ignorance, but I'm a bit new to C++.

I've been handed over a C++ app written in VS2002 which I have to convert to
VS2005. Apparently it's been written in a C style, but cannot comment
myself!

Following the conversion I have numerous errors, which following some
digging around turns out to be because _export is obsolete, and
__declspec(dlle xport) is the replacement. e.g.

Changed:
extern "C" BOOL _export vcgl_posting_ex ists(char * Chart, char *VisibleId,
TK_CONF * TkConf);

To:
extern "C" BOOL __declspec(dlle xport) vcgl_posting_ex ists(char * Chart, char
*VisibleId, TK_CONF * TkConf);

I've changed the entries & recompiled under 2005 but I now get 'Invalid
Access to Memory Location" when trying to register it. To make sure I
compiled the same source (with the changes) under VS2002 and it gave me
exactly the same message! So it looks like the 2005 conversion was not
responsible.

Prior to any work, we used to get 'The specified module could not be found'
when registering the dll, but it would still put entries into the registry
OK, so not sure if it's related. If it is, how do I fix it?!

Any ideas? I do not have a clue!

Martin
Mar 1 '06 #1
7 1905
>I've changed the entries & recompiled under 2005 but I now get 'Invalid
Access to Memory Location" when trying to register it. To make sure I
compiled the same source (with the changes) under VS2002 and it gave me
exactly the same message! So it looks like the 2005 conversion was not
responsible.
I'd agree.
Prior to any work, we used to get 'The specified module could not be found'
when registering the dll, but it would still put entries into the registry
Had you rebuilt the DLL from the sources you'd been given at that
point?

If not, I'd suspect you've not been given the same source. :(
Any ideas? I do not have a clue!


Rather than guessing, you'll need to debug it - build a debug
configuration and learn to use the debugger.

Dave
Mar 1 '06 #2
Hi Martin,
Welcome to MSDN Newsgroup!

In the current situation, I hope you can send me a simplified sample. So I
can repro this problem on my side. I think it's more efficient to get
closer to resolving your issue.
If you have any questions or concerns, please let me know. I am standing by
to help you. Thanks for your understanding!

Best Regards,

Terry Fei [MSFT]
Microsoft Community Support
Get Secure! www.microsoft.com/security
--------------------
From: "Martin Pritchard" <ma************ *@newsgroups.no spam>
Subject: Bizzare error following change of _export to __declspec(dlle xport)
Date: Wed, 1 Mar 2006 13:14:49 -0000
Lines: 35
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
Message-ID: <eJ************ **@TK2MSFTNGP10 .phx.gbl>
Newsgroups: microsoft.publi c.dotnet.langua ges.vc
NNTP-Posting-Host: host217-34-108-233.in-addr.btopenworl d.com 217.34.108.233Path: TK2MSFTNGXA03.p hx.gbl!TK2MSFTN GP08.phx.gbl!TK 2MSFTNGP10.phx. gbl
Xref: TK2MSFTNGXA03.p hx.gbl microsoft.publi c.dotnet.langua ges.vc:54546
X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.vc

Hi,

Sorry for my ignorance, but I'm a bit new to C++.

I've been handed over a C++ app written in VS2002 which I have to convert toVS2005. Apparently it's been written in a C style, but cannot comment
myself!

Following the conversion I have numerous errors, which following some
digging around turns out to be because _export is obsolete, and
__declspec(dll export) is the replacement. e.g.

Changed:
extern "C" BOOL _export vcgl_posting_ex ists(char * Chart, char *VisibleId,
TK_CONF * TkConf);

To:
extern "C" BOOL __declspec(dlle xport) vcgl_posting_ex ists(char * Chart, char*VisibleId, TK_CONF * TkConf);

I've changed the entries & recompiled under 2005 but I now get 'Invalid
Access to Memory Location" when trying to register it. To make sure I
compiled the same source (with the changes) under VS2002 and it gave me
exactly the same message! So it looks like the 2005 conversion was not
responsible.

Prior to any work, we used to get 'The specified module could not be found'when registering the dll, but it would still put entries into the registry
OK, so not sure if it's related. If it is, how do I fix it?!

Any ideas? I do not have a clue!

Martin


Mar 2 '06 #3
"David Lowndes" <Da****@example .invalid> wrote in message
news:n1******** *************** *********@4ax.c om...
I've changed the entries & recompiled under 2005 but I now get 'Invalid
Access to Memory Location" when trying to register it. To make sure I
compiled the same source (with the changes) under VS2002 and it gave me
exactly the same message! So it looks like the 2005 conversion was not
responsible .
I'd agree.
Prior to any work, we used to get 'The specified module could not be
found'
when registering the dll, but it would still put entries into the registry


Had you rebuilt the DLL from the sources you'd been given at that
point?


Yep. And the app run's fine despite the error.

If not, I'd suspect you've not been given the same source. :(
Any ideas? I do not have a clue!


Rather than guessing, you'll need to debug it - build a debug
configuration and learn to use the debugger.

Dave


Any ideas where I can find out how to debug the registration process of the
dll?

Martin
Mar 2 '06 #4
Terry, thanks for the prompt response!

Unfortunately the solution is made up of 5 projects, which can't really be
broken up easily. Also, the code is my company's intellectual property blah
blah blah and sending it out of here could probably cost my job...

In general, should _export work exactly the same as __declspec(dlle xport)?

Any thing you could suggest on where to start looking for a fix?

Martin

""TerryFei" " <v-******@online.m icrosoft.com> wrote in message
news:Gh******** ******@TK2MSFTN GXA03.phx.gbl.. .
Hi Martin,
Welcome to MSDN Newsgroup!

In the current situation, I hope you can send me a simplified sample. So I
can repro this problem on my side. I think it's more efficient to get
closer to resolving your issue.
If you have any questions or concerns, please let me know. I am standing
by
to help you. Thanks for your understanding!

Best Regards,

Terry Fei [MSFT]
Microsoft Community Support
Get Secure! www.microsoft.com/security
--------------------
From: "Martin Pritchard" <ma************ *@newsgroups.no spam>
Subject: Bizzare error following change of _export to
__declspec(dl lexport)
Date: Wed, 1 Mar 2006 13:14:49 -0000
Lines: 35
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
Message-ID: <eJ************ **@TK2MSFTNGP10 .phx.gbl>
Newsgroups: microsoft.publi c.dotnet.langua ges.vc
NNTP-Posting-Host: host217-34-108-233.in-addr.btopenworl d.com

217.34.108.233
Path: TK2MSFTNGXA03.p hx.gbl!TK2MSFTN GP08.phx.gbl!TK 2MSFTNGP10.phx. gbl
Xref: TK2MSFTNGXA03.p hx.gbl microsoft.publi c.dotnet.langua ges.vc:54546
X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.vc

Hi,

Sorry for my ignorance, but I'm a bit new to C++.

I've been handed over a C++ app written in VS2002 which I have to convert

to
VS2005. Apparently it's been written in a C style, but cannot comment
myself!

Following the conversion I have numerous errors, which following some
digging around turns out to be because _export is obsolete, and
__declspec(dl lexport) is the replacement. e.g.

Changed:
extern "C" BOOL _export vcgl_posting_ex ists(char * Chart, char *VisibleId,
TK_CONF * TkConf);

To:
extern "C" BOOL __declspec(dlle xport) vcgl_posting_ex ists(char * Chart,

char
*VisibleId, TK_CONF * TkConf);

I've changed the entries & recompiled under 2005 but I now get 'Invalid
Access to Memory Location" when trying to register it. To make sure I
compiled the same source (with the changes) under VS2002 and it gave me
exactly the same message! So it looks like the 2005 conversion was not
responsible .

Prior to any work, we used to get 'The specified module could not be

found'
when registering the dll, but it would still put entries into the registry
OK, so not sure if it's related. If it is, how do I fix it?!

Any ideas? I do not have a clue!

Martin

Mar 2 '06 #5
>Any ideas where I can find out how to debug the registration process of the
dll?


Martin,

Assuming this is a normal COM registration you're talking about, all
that happens to register it is that it's run like this:

regsvr32 yourdll.dll

Enter that as the command line/parameter in the debugger settings of
the project, and set a breakpoint on your DLL's DllRegisterServ er
function - or let it run till it crashes and see if you can determine
why it crashes.

Dave
Mar 2 '06 #6
Cheers,

Thanks for the link! Looking into it now...

Martin

""TerryFei" " <v-******@online.m icrosoft.com> wrote in message
news:I7******** ******@TK2MSFTN GXA03.phx.gbl.. .
Hi Martin,
Thanks for your update! :)

Based on my knowledge, there is no difference between _export and
_declspec(dllex port). However I strongly suggest you provide an EXPORTS
entry for that function in your module definition (.DEF) file when we want
to export function from a specified dll.
A module-definition (.DEF) file that is a text file containing one or more
module statements that describe various attributes of a DLL include:
LIBRARY statement statement identifies the .DEF file as belonging to a DLL
EXPORTS statement lists the names of the functions exported by the DLL
DESCRIPTION statement describes the purpose of the DLL (Optional)
LIBRARY "DllLibrary "
EXPORTS
FunName @1

You can get more information about (.DEF) file from the following website:
Title: Exporting from a DLL Using DEF Files
URL:http://msdn2.microsoft.com/en-us/library/d91k01sh.aspx

If you have any questions or concerns, please let me know. I am standing
by
to help you. Thanks for your understanding!

Best Regards,

Terry Fei [MSFT]
Microsoft Community Support
Get Secure! www.microsoft.com/security

--------------------
From: "Martin Pritchard" <ma************ *@newsgroups.no spam>
References: <eJ************ **@TK2MSFTNGP10 .phx.gbl>

<Gh************ **@TK2MSFTNGXA0 3.phx.gbl>
Subject: Re: Bizzare error following change of _export to

__declspec(dlle xport)
Date: Thu, 2 Mar 2006 09:42:26 -0000
Lines: 92
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-RFC2646: Format=Flowed; Original
Message-ID: <#S************ **@TK2MSFTNGP15 .phx.gbl>
Newsgroups: microsoft.publi c.dotnet.langua ges.vc
NNTP-Posting-Host: host217-34-108-233.in-addr.btopenworl d.com

217.34.108.233
Path: TK2MSFTNGXA03.p hx.gbl!TK2MSFTN GP08.phx.gbl!TK 2MSFTNGP15.phx. gbl
Xref: TK2MSFTNGXA03.p hx.gbl microsoft.publi c.dotnet.langua ges.vc:54587
X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.vc

Terry, thanks for the prompt response!

Unfortunate ly the solution is made up of 5 projects, which can't really be
broken up easily. Also, the code is my company's intellectual property

blah
blah blah and sending it out of here could probably cost my job...

In general, should _export work exactly the same as __declspec(dlle xport)?

Any thing you could suggest on where to start looking for a fix?

Martin

""TerryFei" " <v-******@online.m icrosoft.com> wrote in message
news:Gh****** ********@TK2MSF TNGXA03.phx.gbl ...
Hi Martin,
Welcome to MSDN Newsgroup!

In the current situation, I hope you can send me a simplified sample. So I can repro this problem on my side. I think it's more efficient to get
closer to resolving your issue.
If you have any questions or concerns, please let me know. I am standing
by
to help you. Thanks for your understanding!

Best Regards,

Terry Fei [MSFT]
Microsoft Community Support
Get Secure! www.microsoft.com/security
--------------------
From: "Martin Pritchard" <ma************ *@newsgroups.no spam>
Subject: Bizzare error following change of _export to
__declspec( dllexport)
Date: Wed, 1 Mar 2006 13:14:49 -0000
Lines: 35
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
Message-ID: <eJ************ **@TK2MSFTNGP10 .phx.gbl>
Newsgroup s: microsoft.publi c.dotnet.langua ges.vc
NNTP-Posting-Host: host217-34-108-233.in-addr.btopenworl d.com
217.34.108.233
Path: TK2MSFTNGXA03.p hx.gbl!TK2MSFTN GP08.phx.gbl!TK 2MSFTNGP10.phx. gbl
Xref: TK2MSFTNGXA03.p hx.gbl microsoft.publi c.dotnet.langua ges.vc:54546
X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.vc

Hi,

Sorry for my ignorance, but I'm a bit new to C++.

I've been handed over a C++ app written in VS2002 which I have to
convert
to
VS2005. Apparently it's been written in a C style, but cannot comment
myself!

Following the conversion I have numerous errors, which following some
digging around turns out to be because _export is obsolete, and
__declspec( dllexport) is the replacement. e.g.

Changed:
extern "C" BOOL _export vcgl_posting_ex ists(char * Chart, char *VisibleId,TK_CONF * TkConf);

To:
extern "C" BOOL __declspec(dlle xport) vcgl_posting_ex ists(char * Chart,
char
*VisibleI d, TK_CONF * TkConf);

I've changed the entries & recompiled under 2005 but I now get 'Invalid
Access to Memory Location" when trying to register it. To make sure I
compiled the same source (with the changes) under VS2002 and it gave me
exactly the same message! So it looks like the 2005 conversion was not
responsible .

Prior to any work, we used to get 'The specified module could not be
found'
when registering the dll, but it would still put entries into the registryOK, so not sure if it's related. If it is, how do I fix it?!

Any ideas? I do not have a clue!

Martin


Mar 3 '06 #7
Ta,

Have entered it in and going to try and debug it.

Thanks for your help,

Martin

"David Lowndes" <Da****@example .invalid> wrote in message
news:at******** *************** *********@4ax.c om...
Any ideas where I can find out how to debug the registration process of
the
dll?


Martin,

Assuming this is a normal COM registration you're talking about, all
that happens to register it is that it's run like this:

regsvr32 yourdll.dll

Enter that as the command line/parameter in the debugger settings of
the project, and set a breakpoint on your DLL's DllRegisterServ er
function - or let it run till it crashes and see if you can determine
why it crashes.

Dave

Mar 3 '06 #8

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

Similar topics

1
1533
by: Marco [Stinger] | last post by:
Hi I'm writing a C# app with VS2003 for WinCE4 / 5 x86. I must call some functions on a Embedded C++ Dll (I have the source code of it). The dll's Header is: #ifdef INTERFACE_EXPORTS #define INTERFACE_API __declspec(dllexport) #else #define INTERFACE_API __declspec(dllimport)
4
5709
by: Scott Chang | last post by:
Hi all I copied the following VC++ 6.0 code (written by someone in the website) to my VC++ .Net 2002-Windows XP Pro PC ////****Solution 'dyndllclass' (2 projects)***/// ///***dynapp****(1st project)***// //----dynapp.cpp----/ #include <windows.h #include "dynclass.h int main ( void
3
2601
by: Gawel | last post by:
Hajo, I have two dlls, both of them are compiled with /clr switch. In first dll project I have managed and unmanaged classes. One of the unmanaged I would like to use outside therefore I marked it as follows: class __declspec(dllexport) Terrain { public: void foo(){} };
7
2619
by: Gustavo L. Fabro | last post by:
Greetings! Some classes that once compiled without problems on VS 2003 have now problems on VS 2005 Beta 1. I'm talking about a __nogc class that is exported with __declspec(dllexport). The compiler message is this: VCSelectLibraryForm.cpp ...\Forms\QiForm.h(48) : error C3395: 'TQiForm::GetDotNetMouseButton' :
5
2217
by: Jason W | last post by:
I have a C# class that I wan't to be able to use in VB6 and VBA applications. To do this I was trying to use a mixed managed VC++ dll and export a function. Doing this I get an error "The memory could not be "read"". Can any one explain what I am doing wrong? This is my Code.
8
12444
by: bonk | last post by:
Hello, I created a MFC extension dll (using VS 2005 Beta 2) that is supposed to export a class that uses .NET internally (See header below) und later shall be used by a plain MFC Project (without the /CLR). As soon as I try to specify __declspec(dllexport) (AFX_EXT_CLASS) I get the following compiler error: Error 2 error C3395: 'CWPFControlProxy::OnWPFButtonClick' : __declspec(dllexport) cannot be applied to a function with the...
3
12434
by: majestik666 | last post by:
Hi, i'm bulding a multi platform app under windows/linux/osx an i have a bit of trouble exporting c++ symbols from a dynamic library... Under windows, i compile a dll exporting symbols using : __declspec(dllexport) & __declspec(dllimport) I do export non-static and static members from my c++ code
2
5120
by: Luis | last post by:
Hello... How can I do an exported function in Visual Basic.Net? In Visual C++ the source is the next... but I need the same in VB.Net Thank you /* This is an example of an exported function. */ __declspec(dllexport) int fnDLLSAMPLE(void) {
1
6280
by: =?Utf-8?B?RmFiaWFu?= | last post by:
Hello, I want to give multiple native classes (in different mixed mode dlls) access to a managed output window (for error messages). Therefore I wrote a native singleton with __declspec (dllexport). I get the following compiler errors: Error 224 error C3389: __declspec(dllexport) cannot be used with /clr:pure or /clr:safe Error 225 error C4394: 'ErrorHandler::instance' : per-appdomain symbol should not be marked with...
0
8156
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8653
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8597
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8306
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7127
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5554
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4065
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2587
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
2
1460
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.