|
Are you wanting reflection, like Java has?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
Hello,
sorry to all because its late answer, yes reflections should be the solution.
Thanks
|
|
|
|
|
Such a thing does not exist, at least not directly, in C++.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
Nope, you have to develop it yourself.
|
|
|
|
|
Hi,
sorry ,i'm little late, thanks for answer.
regards
|
|
|
|
|
|
In C++ this concept are overloading and overriding
Can i use this concept in C?
modified 16-Jun-16 10:40am.
|
|
|
|
|
What would the purpose be?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
|
Yes you can but if you want to do it statically it has to be done via compiler directives and smart macros and it's used by embedded programmers in some specific situations. It is not something we encourage to use like the C++ feature but there are times it is the only way to achieve what is needed.
It has been improved and is portable and easy if your compiler accepts the C11 standard word "_Generic".
Here is a reasonable link on it
Rob's Programming Blog: C11 - Generic Selections[^]
You can see the general form of the macro which provides the overloading
#define acos(X) _Generic((X), \
long double complex: cacosl, \
double complex: cacos, \
float complex: cacosf, \
long double: acosl, \
float: acosf, \
default: acos \
)(X)
As the C community is still one of the larger programming languages the standard has been altered over time. In time order the main standards are C87, C90, C99, C11. Microsoft and Visual Studio has been one of the slowest compilers to include the new standards. Visual studio 2013 was the first version to cover most of C99 but it has been available in GCC and many micro-controller C compilers for many years.
In vino veritas
modified 16-Jun-16 12:55pm.
|
|
|
|
|
Wow, never heard about that, before.
|
|
|
|
|
Well,
Nearly per Definition you can Not use a C Compiler to compile CPP!
You do not understand where it all came from, but I'll ex[plain.
'C' was created by Brian Kernigan and Dennis Ritchie as a High Level Language, with the flexibility of Assembler.
It has a straight forward flat language structure, needing a very simple symbol table. (The Symbol Table is a database used by the Compiler, to keep track of what symbolic value is stored where) This database would not allow for items like 'MyStruct.MyMember'.Instead, it kept a separate Database of Structure Names.
When Brian Stroustrep started CPP, it was initially a 'PreCompiler' which would write a 'C' acceptable set of variable names. For Intance: void MyStruct::MyFunct(int,char,int) would be translated into something like 'FnMyStruct_MyFunct_int_char_int__void'
and then let the 'C' Compiler do it's Job.
That worked of a kind, but, what if one also were to write a 'C' function: 'FnMyStruct_MyFunct_int_char_int__void(int Param)'
Unlikely, but, a potential problem. Brian Stroustrep had to use symbols and characters acceptable to the 'C' language.
When proper CPP Compilers appeared at the scene, the decoration became more flexible. For Instance:
'FnMyStruct?MyFunct??int_char_int???void' Such a name cannot be passed as a 'C' Name. (Note: I do not state that the scheme here is actually used, it is just an illustration to explain the point of how a CPP Compiler generates different code compared to a 'C' compiler)
A CPP compiler can compile 'C' Code. The otherway around, a 'C' Compiler accepting CPP Code is never going to happen, for the reasons stated above.
Now, As others have Asked:
what is your problem!
Perhaps you want to Include a 'C' Module in your 'CPP Project'
Bram van Kampen
|
|
|
|
|
Hi,
I am working on a project in Visual C++ 6.0. I have included the following statements in a file:
#import "C:\Program Files\Common Files\System\ado\msado15.dll" \
rename( "EOF", "adoEOF" )
#import "c:\Program Files\Common Files\system\ado\msadox.dll" \
no_namespace
I am getting the following error:
error C2556: 'enum DataTypeEnum __thiscall ADODB::Field20::GetType(void)' : overloaded function differs only by return type from 'enum ADODB::DataTypeEnum __thiscall ADODB::Field20::GetType(void)'
Any idea why this error is generated...?
How to resolve the above issue...?
Regards,
mba
modified 16-Jun-16 3:44am.
|
|
|
|
|
The definition of that enum exists in two places. You need to check the libraries to see how you can eleiminate one of them. I would guess it may have something to do with the second import using the no_namespace option.
|
|
|
|
|
Richard was spot on ADO and ADOX both use the no_namespace option you need to rename the functions of one into a renamed namespace
#import "..\..\..\dll\msadox.dll"
#import "..\..\..\dll\msado15.dll" no_namespace rename("EOF", "EOFADO")rename("DataTypeEnum", "DataTypeEnumADO") rename("EditModeEnum", "EditModeEnumADO") \
rename("FieldAttributeEnum", "FieldAttributeEnumADO") rename("LockTypeEnum", "LockTypeEnumADO")
You could choose to import the ADO and rename the ADOX functions, rename the one you use least.
In vino veritas
|
|
|
|
|
Dear All,
Below is my Problem Statement.
Currently i am trying to Calculate checksum using File Attribute(File Size) as Checksum input to Checksum Algorithm to get the Checksum hash and i am using the IDE Microsoft VS 2015 C++ for the same
The above said scenario is working fine for me .
It gives me below output and its proper one.
Input : Hello
Hash :f7ff9e8b7bb2e09b70935a5d785e0cc5d9d0abf0
**********************
So, i am trying to replicate the Same thing in Microsoft Visual C++ 6.0 and i am not not able build/Run the project.
and i can see lots of External Dependencies are being referred from Program files.
So,I request the somebody to share the Working piece of code which does SHA1 Checksum validation for the given input in VS 6.0 C++.
I really appreciate if somebody could help me out to resolve the issue.
Thanks,
Goutham KD
|
|
|
|
|
Member 12485116 wrote: ...i am not not able build/Run the project.
and i can see lots of External Dependencies are being referred from Program files. And we are supposed to know what these are?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
Hi.
the external references for Example : wincrypt.h,Cryptohash.h etc.
which reside inside below path.
C:\Program Files (x86)\Windows Kits\8.1\Include\um
there are lot many refereces inside above mentioned headers.
|
|
|
|
|
So if the files reside on your computer (it would be an entirely different problem if you were trying to reference non-existent files), what exactly is the problem?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
I suspect OP's problem may be related to the antiquity of VC6.
Cheers,
Peter
Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012
|
|
|
|
|
Hello All,
Just let me know On how to Add External dependencies in VS 6.0 C++ project.
Thanks.
|
|
|
|
|
External dependencies are libraries or object files. They can be added in the project settings at Properties - Linker - Input - Additional dependencies (not quite sure for VC6 but should be). Specify the full path. Optionally add the path(es) at Properties - Linker - General - Additional library directories. Then you can specify the plain name.
The functions exported by libraries are declared in header files. These must be included in the source and header files that use declarations from those header files. Like with library directories you can avoid specifying the path in the include statements by adding the directories to the project settings (Properties - C/C++ - General - Additional include directories; again not sure with VC6).
|
|
|
|
|
I have doubts this will work the 8.1 kit code is expecting v120XP platform toolset and linking. It will be really interesting to see if it does work.
Is there a reason you can't just download and install VS2015, something funky with the code?
In vino veritas
|
|
|
|
|
Possibly, but I still use it too.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
I am new to C++ I want to define my functions declaration in a seprate header file and definitions in 2 different header files. I am saving the file with .h and .c extension in same folder where main file is located too. I also know that I have to use double quotes to include my files in main. However, I am unable to find the way to define my header file for definitions and declaration. Please give me a small example so that I can get idea about it
|
|
|
|