|
Thank you Sir, I have Solved the problem
Here is the Fixed Code
#include <cstdlib>
#include <iostream>
#include <windows.h>
using namespace std;
typedef int __stdcall cbtype (char *what, int int1, int int2, char *str);
int __stdcall somecallback (char *what, int int1, int int2, char *str)
{
cout << what << endl;
cout << int1 << endl;
cout << int2 << endl;
cout << str << endl;
}
void ArcExtract ()
{
HINSTANCE GetProcDLL = LoadLibrary("unarc.dll");
FARPROC GetProcessID = GetProcAddress(HMODULE(GetProcDLL), "FreeArcExtract");
typedef int (__stdcall * CallingFun)(cbtype, ...);
CallingFun FreeArcExtract;
FreeArcExtract = CallingFun(GetProcessID);
FreeArcExtract(somecallback,"l", "--", "d:\\test.arc", "", "", "", "", "", "", "");
FreeLibrary(GetProcDLL);
}
int main(int argc, char *argv[])
{
ArcExtract ();
system("pause");
return EXIT_SUCCESS;
}
|
|
|
|
|
Can anybody tell me why there are TWO implementations for the MFC message map? I think the non _AFXDLL version will be OK in both the static library and dynamic library.
#ifdef _AFXDLL
#define DECLARE_MESSAGE_MAP() \
private: \
static const AFX_MSGMAP_ENTRY _messageEntries[]; \
protected: \
static AFX_DATA const AFX_MSGMAP messageMap; \
static const AFX_MSGMAP* PASCAL _GetBaseMessageMap(); \
virtual const AFX_MSGMAP* GetMessageMap() const; \
#else
#define DECLARE_MESSAGE_MAP() \
private: \
static const AFX_MSGMAP_ENTRY _messageEntries[]; \
protected: \
static AFX_DATA const AFX_MSGMAP messageMap; \
virtual const AFX_MSGMAP* GetMessageMap() const; \
#endif
|
|
|
|
|
I have never noticed this but partly the answer is obvious if you take a look at the name of the defined identifier after the #ifdef, its _AFXDLL. The MFC libraries can be linked statically into your executable/DLL or you can choose to be linked dynamically so that your program will depend on the existence of an mfc library dll where your program is used. It seems that they needed different macros to wire together their system in these 2 different cases but this is a tiny implementation detail inside MFC you dont have to be aware of. In general you often have to handle some problems specially when you put part of your code into a DLL, but its not important what their reason was for creating those 2 different defines because they provide the same interface for you.
|
|
|
|
|
|
|
I noticed that the latest MFC messageMap has a new implementation, it is not ambiguous anymore! there is no _AFXDLL version.
|
|
|
|
|
pasztorpisti has gven you some good advice and I would just add to it, to ensure that you do not mix MFC within an application. By that, I mean if you are building a DLL for an application and that application uses MFC linked statically, then ensure that your DLL has MFC linked statically as well. The converse is also true. If the application links MFC dynamically, then ensure that you're DLL links MFC dynamically.
Chris Meech
I am Canadian. [heard in a local bar]
In theory there is no difference between theory and practice. In practice there is. [Yogi Berra]
posting about Crystal Reports here is like discussing gay marriage on a catholic church’s website.[Nishant Sivakumar]
|
|
|
|
|
Agree, very useful info to help avoiding some disasters.
|
|
|
|
|
Thanks.
Chris Meech
I am Canadian. [heard in a local bar]
In theory there is no difference between theory and practice. In practice there is. [Yogi Berra]
posting about Crystal Reports here is like discussing gay marriage on a catholic church’s website.[Nishant Sivakumar]
|
|
|
|
|
how to watch the code of the software of th ImageStone?
why I cannot see the code of some function? ,
for example how the see the function code of colour level,
|
|
|
|
|
If you have the source code then you need to build it in Debug mode. If you do not have the source code then see here[^].
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Can someone tell me why C++ and C programming languages are used than any other programming languages, what can these languages do that others can't. I do know that C can create drivers or system files, which is very important when you become serious about your projects. But why is the industry still use it? And will C or C++ ever die, even though it's a non-stop updating language everyday, and what other languages update just like C/C++.
EDIT:
While also asking this question, will C++/CLI take over or kill out Standard/Win32 C++?
Cause I'm on a website called Codejock Software, looking for a ribbon control to work for Standard/Win32 C++ only, and I can't find it. Most of the controls are only made for C++/CLI.
Simple Thanks and Regards,
Brandon T. H.
Programming in C and C++ now, now developing applications, services and drivers (and maybe some kernel modules...psst kernel-mode drivers...psst).
Many of life's failures are people who did not realize how close they were to success when they gave up. - Thomas Edison
modified 3-Oct-12 14:46pm.
|
|
|
|
|
Brandon T. H. wrote: what can these languages do that others can't.
Directly access the hardware, directly manage memory, and create high performance code.
(As opposed to managed languages)
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Brandon T. H. wrote: But why is the industry still use it?
because it still works.
Brandon T. H. wrote: even though it's a non-stop updating language everyday, and what other languages update just like C/C++
C++ has had all of four official standard changes since 1998.
|
|
|
|
|
Stop worrying about mortality, it's of little use.
Steve
|
|
|
|
|
If you know them then you know the reason why.
On the other hand, if you don't know them, it's time to learn.
Veni, vidi, vici.
|
|
|
|
|
The C and C++ languages are disastrous. They leave so many doors open for bugs and programming mistakes and they have other design failures (like header files that terribly slow down the compile time). The only valid reason for their existence is that most of today's libraries and operating systems are written using these languages. The interface of the majority of libraries and operating system APIs are still C based. Even if you try to replace these languages I think you need 3 different languages to build a whole operating system up on top of bare hardware. A minimal amount of assembly to communicate with hardware, a thin layer of relatively high level but unsafe language that allows for manual memory management in the low-level part of the operating system, and a high level safe language that can be used to write the top level of the operating system and the user programs. C/C++ could be something like the middle from these 3 languages but it would be easier to design a much better language than C/C++ with the same capabilities. Again, the only reason for the existence of C/C++ is massive amount of legacy code.
EDIT: This post of mine became quite 'popular', for this reason I would like to link one of my other posts that contains a more comprehensive (but not full) list of my reasonings at the end of this quite long debate: http://www.codeproject.com/Messages/4377527/Re-What-makes-C-and-Cplusplus-a-good-language.aspx[^]
Also would like to mention that I have extensive background in low level programming including assembly, C, and C++, reverse engineering and I'm not a 'just because'-type of hater of C/C++ who used only scripts and managed languages - I don't hate C/C++ at all. I respect these languages because they have been fun for me to program in, they helped the world to become better, but we have to see their obvious defects as well. Thanks for reading.
modified 25-Sep-12 8:47am.
|
|
|
|
|
pasztorpisti wrote: The C and C++ languages are disastrous. I think this is rather unfair. C was created to make the writing of operating system code much easier; C++ was an improvement but still based around the same design goals. The fact that people wrote other programs using those languages is the fault of the developers rather than the languages. Yes, there are shortcomings compared with some modern languages, but neither C nor C++ were designed to do some of the work that people expect of it these days.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
If we speak of a massive codebase like one that an operating system has then the build time and header hell are alone enough to say that C/C++ is a bad choice. The problem is that the accident has already happened and windows and linux are already in C. The difficulties in parsing and translating C++ just add to compile times and project complexities. In theory it would be easy to design a language that is suitable for writing operating system code without several defects that accumulated in C/C++ over the decades (because of its backward compatibility) so I think my statement isn't unfair at all. Not to mention the different C/C++ languages per compiler, this language isn't compatible even with itself in practice!
|
|
|
|
|
pasztorpisti wrote: enough to say that C/C++ is a bad choice. When it was chosen, it was the only choice.
pasztorpisti wrote: In theory it would be easy to design a language that is suitable for writing operating system code without several defects I worked for a company (Sperry) that did just that. They spent thousands developing a language that had no practical use except for writing their operating system, which was fast reaching the end of its useful life.
pasztorpisti wrote: I think my statement isn't unfair at all. I meant it was unfair in that you were judging a language developed in the 80s by the standards of today's knowledge and technology.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Richard MacCutchan wrote: When it was chosen, it was the only choice.
Today its not the only choice. Some people choose it because they don't know its defects, or they don't have other choices to develop low level code, and because of the big masses of legacy code.
Richard MacCutchan wrote: I worked for a company (Sperry) that did just that. They spent thousands developing a language that had no practical use except for writing their operating system, which was fast reaching the end of its useful life.
We don't know how good that language was. Its not sure that the language was good. Even if something is good, it doesn't mean it becomes widespread. "The rich gets richer." as the C/C++ becomes more and more widespread.
Richard MacCutchan wrote: I meant it was unfair in that you were judging a language developed in the 80s by the standards of today's knowledge and technology.
If we were speaking about its application in the 80s then it would be unfair. Since we are speaking about its application today its not unfair to say that the only thing that keeps it alive is legacy code. Its just telling the cruel truth.
|
|
|
|
|
pasztorpisti wrote: Today its not the only choice. Quite true, and I never disputed this.
pasztorpisti wrote: We don't know how good that language was. I do, It was OK and somewhat similar to C, but so specialised it had no chance of being used on any hardware other than the 1100/2200 range.
pasztorpisti wrote: its not unfair to say that the only thing that keeps it alive is legacy code. There are still lots of new developments being done with C and/or C++ because people think they are the right language for the job, despite their many shortcomings, so in that respect it probably is unfair.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Richard MacCutchan wrote: I do, It was OK and somewhat similar to C, but so specialised it had no chance of being used on any hardware other than the 1100/2200 range.
The low level language I was dreaming about is general purpose like C. If that language was hardware specific then its death is natural when the hardware goes out of production because its not a general purpose lang, its rather a high level assembly for the target hardware.
C is quite general purpose to be able to translate to any processors. By fixing some things in C++ and removing the header hell (by using units like in pascal) it could be a very nice low level language.
Richard MacCutchan wrote: There are still lots of new developments being done with C and/or C++ because people think they are the right language for the job, despite their many shortcomings, so in that respect it probably is unfair.
One of these days I'm going to think of a really clever signature.
Many people choose this language because today this knowledge is quite useful because of the legacy codebases and because it is recommended by their friends. Because of this C/C++ is still the "native language" of many and they use this because they know this, not because they think that it is a better choice than x and y because they simple don't know about x and y as an alternative. The ugly truth is that because of the legacy codebase often C/C++ is the best choice, but this doesnt mean that its a best choice because its a nice language.
|
|
|
|
|
pasztorpisti wrote: Today its not the only choice
So what language would you choose today to write a new OS in ?
...cmk
The idea that I can be presented with a problem, set out to logically solve it with the tools at hand, and wind up with a program that could not be legally used because someone else followed the same logical steps some years ago and filed for a patent on it is horrifying.
- John Carmack
|
|
|
|
|
Today there are sh*t loads of OSes, why would you want to write a new one? Anyway, 99% of the ongoing projects is not an operating system so you can pick from lots of other popular languages. In one of my previous posts I mentioned that there is no other similar low level language however by fixing some issues with C could result in a good one to write driver level stuff.
|
|
|
|