What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » Visual C++ 6.0 DLLs

Pages: (2): « First « 1 [ 2 ] Last »
Visual C++ 6.0 DLLs
Author: Message:
vikke
Senior Member
****

Avatar

Posts: 900
Reputation: 28
31 / Male / Flag
Joined: May 2006
RE: Visual C++ 6.0 DLLs
Disable name mangling and it will work. This has nothing to do with DllMain. :)
09-22-2007 09:42 PM
Profile E-Mail PM Find Quote Report
Spunky
Former Super Mod
*****

Avatar

Posts: 3658
Reputation: 61
36 / Male / Flag
Joined: Aug 2006
O.P. RE: Visual C++ 6.0 DLLs
quote:
Originally posted by vikke
It is mangled. Click F10 in Dependency Walker to unmangle all function names

That screenshot is after I'd told it to "undecorate functions" which is what F10 does... Do I have to do something differently?
<Eljay> "Problems encountered: shit blew up" :zippy:
09-23-2007 12:23 AM
Profile PM Find Quote Report
vikke
Senior Member
****

Avatar

Posts: 900
Reputation: 28
31 / Male / Flag
Joined: May 2006
RE: Visual C++ 6.0 DLLs
Dependency Walker does undecorate these functions (for viewing only). The DLL is not changed, and you have to change your compiler options so it won't decorate your export functions.
09-23-2007 06:02 AM
Profile E-Mail PM Find Quote Report
TheSteve
Full Member
***

Avatar
The Man from Japan

Posts: 179
Reputation: 23
40 / Male / Flag
Joined: Aug 2005
RE: Visual C++ 6.0 DLLs
Your function should be declared something like this

code:
int WINAPI sum (int n1, int n2)
{
    return n1+n2;
}

Do not use any form of C++ style dll exporting ( DECLSPEC_EXPORT ) as this is for C++ only. If you want to use the function in VB, the function needs to be exported by name only.

in your def file, you should have something like
code:
LIBRARY "functions"
DESCRIPTION "Some description here"
EXPORTS
    ;Explicit exports go here
    sum

If this still doesn't work, make sure that your def file has the same name as the project.

This post was edited on 09-24-2007 at 02:04 AM by TheSteve.
09-24-2007 02:01 AM
Profile PM Web Find Quote Report
RaceProUK
Elite Member
*****

Avatar

Posts: 6073
Reputation: 57
39 / Male / Flag
Joined: Oct 2003
RE: Visual C++ 6.0 DLLs
You can use delcspec(dllexport), so long as you also use extern "C". extern "C" disables name mangling for that function.
[Image: spartaafk.png]
09-24-2007 10:29 PM
Profile PM Web Find Quote Report
Spunky
Former Super Mod
*****

Avatar

Posts: 3658
Reputation: 61
36 / Male / Flag
Joined: Aug 2006
O.P. RE: Visual C++ 6.0 DLLs
Ok, I've fixed it now. I needed to re-add the def file once I opened my workspace so I think it was including the file for some reason... Works in VB now at least. All I have to do now is learn C++ :tongue:
<Eljay> "Problems encountered: shit blew up" :zippy:
09-24-2007 11:09 PM
Profile PM Find Quote Report
TheSteve
Full Member
***

Avatar
The Man from Japan

Posts: 179
Reputation: 23
40 / Male / Flag
Joined: Aug 2005
RE: RE: Visual C++ 6.0 DLLs
quote:
Originally posted by RaceProUK
You can use delcspec(dllexport), so long as you also use extern "C". extern "C" disables name mangling for that function.

The trouble with using __declspec(dllexport) with extern "C" is that the function must be __cdecl in order for the symbol to export without any decoration. Why is this a problem? VB requires dll import functions to be __stdcall
09-25-2007 01:09 AM
Profile PM Web Find Quote Report
RaceProUK
Elite Member
*****

Avatar

Posts: 6073
Reputation: 57
39 / Male / Flag
Joined: Oct 2003
RE: Visual C++ 6.0 DLLs
I always thought extern "C" turned off the decoration completely. After all, __stdcall is merely a calling convention.
[Image: spartaafk.png]
09-27-2007 07:54 PM
Profile PM Web Find Quote Report
Verte
Full Member
***

Avatar

Posts: 272
Reputation: 7
Joined: Apr 2007
RE: RE: RE: Visual C++ 6.0 DLLs
quote:
Originally posted by TheStevethe function must be __cdecl in order for the symbol to export without any decoration.


I don't see why. You can write C programs that export functions with __stdcall calling conventions.
was put impeccably into words at DebianDay for me last Saturday, by Knut Yrvin of Trolltech - adults try something once, fail, and then are like "ffs this doesn't work". Children try, fail, and then try again, and succeed - maybe on the second, or even fifth retry. But the thing is that they keep at it and overcome the problems in the end.

-andrewdodd13
09-28-2007 03:12 AM
Profile E-Mail PM Find Quote Report
Pages: (2): « First « 1 [ 2 ] Last »
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On