15,900,511 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Pesmontis (Top 4 by date)
Pesmontis
2-Oct-10 6:16am
View
I've got it to work with the following changes:
#define FUNCDECL(ret, name, args) \
typedef ret (__cdecl *raw_##name) args; \
raw_##name* name = (raw_##name*)&_##name;
and:
FUNCDECL(unsigned int, GetUncompressedLength, (void*, unsigned int));
So this means I had to stop using standard calls, and I think that it is necessary to specify the exact function arguments (ie. without my own parameter names). Therefor I can now answer my own first question:
It is not necessary to create class prototypes in order to address the exports listed above (even / only for member functions from singleton classes).
The answer to the second question is: you can probably use a force cast as suggested by the codeguru article if you use a __cdecl convention. However, this is not necessary therefor I have not tested it.
The answer to the third question is: if you address the function(s) properly, using proper arguments, then the return value is indeed the function result. This will be a pointer if it is specified as a pointer. In the example I described above, the output was produced with improper function arguments. I should not have added argument names.
Pesmontis
26-Sep-10 16:48pm
View
Reason for my vote of 5
Automatic vote of 5 for accepting answer.
Pesmontis
22-Sep-10 15:43pm
View
I still get the Debug error: "The value of ESP was not properly saved across a function call"
Pesmontis
6-Sep-10 12:22pm
View
I wasn't too careful when typing my question, I should have typed "-- decorated name --" where it previously read "-- undecorated name --".
Before I posted this question I did test code like you (both) propose, but that way I never got a proper pointer to the function (always error 'access violation'). I read somewhere else that I should use the decorated function names, and this is working: the functions are present and accept input without raising further errors.
Note that my three questions are quite specific, so what I'm really interested in is (more) specific answers.