© J.C. Kessels 2009
MyDefrag Forum
June 20, 2013, 02:39:39 am
Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News
:
Home
Help
Search
Login
Register
MyDefrag Forum
>
JkDefrag v3 Forum
>
Programming with the library
>
Function Decoration - ?RunDefrag@@YAHPA_WHH@Z
Pages: [
1
]
« previous
next »
Print
Author
Topic: Function Decoration - ?RunDefrag@@YAHPA_WHH@Z (Read 10614 times)
Matt
Guest
Function Decoration - ?RunDefrag@@YAHPA_WHH@Z
«
on:
December 12, 2006, 08:09:34 am »
Curious, why is this function decorated and the other two are not? I've looked at the source, I don't see why it is and the others are not.
Just noticed this while investigating why the app was faulting in init. Changed my declaration, strange though....
Matt
Logged
bv
Guest
Function Decoration - ?RunDefrag@@YAHPA_WHH@Z
«
Reply #1 on:
December 12, 2006, 02:15:53 pm »
Hi Matt,
Try changing the path declaration to :
DEFRAG_API int RunDefrag(WCHAR *Path, int Mode, int Speed);
in the header file.
Should do the trick, with or without a DEF file actually.
Regards,
bruno
PS: i hate those confirmation codes...
Logged
Matt
Guest
Function Decoration - ?RunDefrag@@YAHPA_WHH@Z
«
Reply #2 on:
December 12, 2006, 03:47:07 pm »
Actually, I was refering not to anything I've built, but the compiled library in the zip. Look at it with depends and you'll see what I mean (version 3.1).
I don't quite understand how your change would affect this though. I see the block is wrapped in an "export C" which should eliminate the function name garbage....
Logged
Anonymous
Guest
Function Decoration - ?RunDefrag@@YAHPA_WHH@Z
«
Reply #3 on:
December 12, 2006, 03:59:32 pm »
Matt,
I have uploaded a new zip file with the modified header.
Please try it and tell me how exports now look like.
bv
PS: those forum conf. codes really get on my nerves...
Logged
Matt
Guest
Function Decoration - ?RunDefrag@@YAHPA_WHH@Z
«
Reply #4 on:
December 12, 2006, 04:27:51 pm »
- JkDefragDll.h still looks the same. What did you change(downloaded from your thread's link, not JK's on the main page)?
Seems there is a miscommunication.... Let me be specific:
All three exported functions are prefaced with __declspec(dllexport).
All Three are in an extern "C" block.
Since all three functions are declared the same, I don't see why RunDrag appears different when viewed in dependency walker. It's exports are shown as:
?RunDefrag@@YAHPA_WHH@Z
DefragInitialize
StopDefrag
I'm attempting to statically link too the library in Delphi therefor the exported name does matter a little.
From my understanding of C, this doesn't make sense too me. The first export has C++ function junk added while the second two don't. I can't see any difference between how these three functions are declared in the header.
Logged
Anonymous
Guest
Function Decoration - ?RunDefrag@@YAHPA_WHH@Z
«
Reply #5 on:
December 12, 2006, 05:00:05 pm »
Matt,
You lost me a little here.
I just changed 1 single line in JKDefragDLL.h:
Code:
DEFRAG_API int RunDefrag(WCHAR *Path, int Mode, int Speed);
i.e. *Path to WCHAR
I then ran 'dumpbin /exports' to check the DLL structure:
Quote
Microsoft (R) COFF/PE Dumper Version 8.00.50727.42
Copyright (C) Microsoft Corporation. All rights reserved.
Dump of file c:\defragdll.dll
File Type: DLL
Section contains the following exports for DefragDLL.dll
00000000 characteristics
457ED05B time date stamp Tue Dec 12 16:52:59 2006
0.00 version
1 ordinal base
3 number of functions
3 number of names
ordinal hint RVA name
1 0 00006790 DefragInitialize = _DefragInitialize
2 1 00006760 RunDefrag = _RunDefrag
3 2 00006780 StopDefrag = _StopDefrag
Summary
1000 .data
1000 .rdata
1000 .reloc
1000 .rsrc
7000 .text
Voilą!! No mangled names, which by the way can be created just as well in C as C++, hence DEF files.
I hope this helps,
bv
PS: i must be seriously 'visually impaired' ... :x :x :x
Logged
jeroen
Administrator
JkDefrag Hero
Posts: 7156
Function Decoration - ?RunDefrag@@YAHPA_WHH@Z
«
Reply #6 on:
December 12, 2006, 10:45:47 pm »
I have examined the DLL with a DLL-browser can see the weird name, but I have no idea why! I'll have to look into it.
Logged
bv
Guest
Function Decoration - ?RunDefrag@@YAHPA_WHH@Z
«
Reply #7 on:
December 13, 2006, 08:10:16 am »
Hi Jeroen,
Have you tried the above slight code modification in the header file (WCHAR)?
bruno
Logged
Matt
Guest
Function Decoration - ?RunDefrag@@YAHPA_WHH@Z
«
Reply #8 on:
December 13, 2006, 11:06:19 am »
Bruno,
That haven't recompiled, but I see what you're pointing out now... RunDefrag's prototype in the header is a CHAR while in the dll's CPP file it's WCHAR.
I don't think that is the cause of the name mangling, but is a bug....
Matt
Logged
Matt
Guest
Function Decoration - ?RunDefrag@@YAHPA_WHH@Z
«
Reply #9 on:
December 13, 2006, 11:14:12 am »
On second thought, if the build dir wasn't clean and there were obj's from previous builds in there, and W4 wasn't used, I suppose the compiler/linker could become confused.... Uhh, I dunno.... :-)
m
Logged
bv
Guest
Function Decoration - ?RunDefrag@@YAHPA_WHH@Z
«
Reply #10 on:
December 13, 2006, 11:48:55 am »
Hi Matt,
This is a tiny declaration bug indeed.
I haven't had time to write a small client for the DLL, but i assume changing the *Path declaration to WCHAR does the trick. Please confirm.
i believe my latest post (
http://www.foretrade.com/downloads/jkdefragdll.zip
) is clean now.
cheers,
bruno
PS: I am visually impaired or downright dumb, but this posting confirmation coded make me flipping mad... :x :x :x
so i'll stop posting until this is fixed
Logged
jeroen
Administrator
JkDefrag Hero
Posts: 7156
Function Decoration - ?RunDefrag@@YAHPA_WHH@Z
«
Reply #11 on:
December 13, 2006, 12:09:08 pm »
The WCHAR bug is indeed the cause of the problem! I have now uploaded version 3.2 with the fix. Strange that I didn't get a compilation error.
Quote from: "bv"
this posting confirmation coded make me flipping mad...
The CAPTCHA confirmation is an absolute necessity, without it the forum would be flooded with spammer messages. It's only active if you're not logged in. So all you have to do is register, and then login before you post a message. Activate cookies to automatically login.
Logged
Matt
Guest
Function Decoration - ?RunDefrag@@YAHPA_WHH@Z
«
Reply #12 on:
December 13, 2006, 01:43:07 pm »
Quote from: "jeroen"
Strange that I didn't get a compilation error.
This is indeed strange. I learn something new every day. I definitely would of expected a compiler error instead of a mangled name... This is why I didn't understand that Bruno was trying too say at first.
Yes Bruno, the library works fine. In delphi, changing the path data type too a PWideChar from PChar works great (this is with the bug, I'm sure the new version 3.2 will work as well).
All is good...
Matt
Logged
bv
JkDefrag Junior
Posts: 5
Function Decoration - ?RunDefrag@@YAHPA_WHH@Z
«
Reply #13 on:
December 13, 2006, 03:04:46 pm »
Matt,
This is only a filterable warning for most compilators since both types can be easily "inter-casted".
Sorry if i didn't make myself clear early enough, but i'm glad it works now, and I'm sure a nice GUI or a NT service can now be written based on this nice little utility from Jeroen.
Lastly, I registered to this forum particularly because these posting conf codes peeve me off big time. As a note to Jeroen, visually impaired people or other twitheads like me can't contact you either on the form as one needs to be white-listed with you first. So I suggest you just make this place a member-only forum if only for the sake of keeping sane...
Cheers,
bruno
Logged
jeroen
Administrator
JkDefrag Hero
Posts: 7156
Function Decoration - ?RunDefrag@@YAHPA_WHH@Z
«
Reply #14 on:
December 13, 2006, 08:31:43 pm »
Quote from: "bv"
I suggest you just make this place a member-only forum
I appreciate your suggestion, and I do agree that the CAPTCHA and the whitelist that protects my mailbox are a hassle. But changing the forum to members-only is not the solution. It would mean that everybody has to register first. Lot's of people simply will not do that, yourself as an example, you only registered after several postings. I am looking at other forum software though, I'm not happy with the capabilities of phpBB.
Logged
Pages: [
1
]
Print
« previous
next »
Jump to:
Please select a destination:
-----------------------------
MyDefrag v4 Forum
-----------------------------
=> Announcements
=> Questions and help
=> Bugs and problems
=> Requests for new features
=> Scripts, and other contributions
-----------------------------
JkDefrag v3 Forum
-----------------------------
=> Announcements
=> Questions and help
=> Bugs and problems
=> Requests for new features
=> Programming with the library
Loading...