Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / March 2006

Tip: Looking for answers? Try searching our database.

Bizzare error following change of _export to __declspec(dllexport)

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Martin Pritchard - 01 Mar 2006 13:14 GMT
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
David Lowndes - 01 Mar 2006 17:24 GMT
>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
Martin Pritchard - 02 Mar 2006 09:34 GMT
> >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
[quoted text clipped - 10 lines]
> 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. :(
>
[quoted text clipped - 4 lines]
>
> Dave

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

Martin
David Lowndes - 02 Mar 2006 11:53 GMT
>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
Martin Pritchard - 03 Mar 2006 09:35 GMT
Ta,

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

Thanks for your help,

Martin

> >Any ideas where I can find out how to debug the registration process of
> >the
[quoted text clipped - 13 lines]
>
> Dave
"TerryFei" - 02 Mar 2006 02:06 GMT
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" <martinpritchard@newsgroups.nospam>
>Subject: Bizzare error following change of _export to __declspec(dllexport)
[quoted text clipped - 8 lines]
>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!TK2MSFTNGP10.phx.gbl
>Xref: TK2MSFTNGXA03.phx.gbl microsoft.public.dotnet.languages.vc:54546
[quoted text clipped - 33 lines]
>
>Martin
Martin Pritchard - 02 Mar 2006 09:42 GMT
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

> Hi Martin,
> Welcome to MSDN Newsgroup!
[quoted text clipped - 67 lines]
>>
>>Martin

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.