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

Bizzare error following change of _export to __declspec(dllexport)

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_exists(char * Chart, char *VisibleId,
TK_CONF * TkConf);

To:
extern "C" BOOL __declspec(dllexport) vcgl_posting_exists(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 1894
>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.nospam>
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>
Newsgroups: microsoft.public.dotnet.languages.vc
NNTP-Posting-Host: host217-34-108-233.in-addr.btopenworld.com 217.34.108.233Path: TK2MSFTNGXA03.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP10.phx.gbl
Xref: TK2MSFTNGXA03.phx.gbl microsoft.public.dotnet.languages.vc:54546
X-Tomcat-NG: microsoft.public.dotnet.languages.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(dllexport) is the replacement. e.g.

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

To:
extern "C" BOOL __declspec(dllexport) vcgl_posting_exists(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.com...
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(dllexport)?

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

Martin

""TerryFei"" <v-******@online.microsoft.com> wrote in message
news:Gh**************@TK2MSFTNGXA03.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.nospam>
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>
Newsgroups: microsoft.public.dotnet.languages.vc
NNTP-Posting-Host: host217-34-108-233.in-addr.btopenworld.com

217.34.108.233
Path: TK2MSFTNGXA03.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP10.phx.gbl
Xref: TK2MSFTNGXA03.phx.gbl microsoft.public.dotnet.languages.vc:54546
X-Tomcat-NG: microsoft.public.dotnet.languages.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_exists(char * Chart, char *VisibleId,
TK_CONF * TkConf);

To:
extern "C" BOOL __declspec(dllexport) vcgl_posting_exists(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 DllRegisterServer
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.microsoft.com> wrote in message
news:I7**************@TK2MSFTNGXA03.phx.gbl...
Hi Martin,
Thanks for your update! :)

Based on my knowledge, there is no difference between _export and
_declspec(dllexport). 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.nospam>
References: <eJ**************@TK2MSFTNGP10.phx.gbl>

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

__declspec(dllexport)
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.public.dotnet.languages.vc
NNTP-Posting-Host: host217-34-108-233.in-addr.btopenworld.com

217.34.108.233
Path: TK2MSFTNGXA03.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP15.phx.gbl
Xref: TK2MSFTNGXA03.phx.gbl microsoft.public.dotnet.languages.vc:54587
X-Tomcat-NG: microsoft.public.dotnet.languages.vc

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(dllexport)?

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

Martin

""TerryFei"" <v-******@online.microsoft.com> wrote in message
news:Gh**************@TK2MSFTNGXA03.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.nospam>
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>
Newsgroups: microsoft.public.dotnet.languages.vc
NNTP-Posting-Host: host217-34-108-233.in-addr.btopenworld.com
217.34.108.233
Path: TK2MSFTNGXA03.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP10.phx.gbl
Xref: TK2MSFTNGXA03.phx.gbl microsoft.public.dotnet.languages.vc:54546
X-Tomcat-NG: microsoft.public.dotnet.languages.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_exists(char * Chart, char *VisibleId,TK_CONF * TkConf);

To:
extern "C" BOOL __declspec(dllexport) vcgl_posting_exists(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 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.com...
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 DllRegisterServer
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
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...
4
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...
3
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...
7
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...
5
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...
8
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...
3
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 :...
2
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...
1
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...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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,...
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...

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.