|
#ifdef BUILD_DLL
#define LINKAGE __declspec(dllexport)
#else
#define LINKAGE __declspec(dllimport)
#endif
Yes, yes... I didn't write that but I know that... I use some think like that in my project.
I can not do that in this way that you propose. If I do that I will need to edit about teen files... this is to much work for me and doesn't look good. But your idea is very good... I learnt a lot from you.
I found another way to resolve my problem.
#ifndef __A_H_INCLUDE__
#define __A_H_INCLUDE__
class B;
class A
{
friend D;
public:
A( B* b )
: bb( b )
{
}
virtual void foo()
{
if ( d )
d->foo( bb, this );
}
protected:
D *d;
B *bb;
};
#endif
This some kind of delegation I think. Delegation is a idiom of C++ and that is ok. D class is not a stupid class hire. D class has a some sense. Do you like this idea? Is this good and look for professional code? I need to delegate about seven function.
Regards.
|
|
|
|
|
"
#ifdef BUILD_DLL#define LINKAGE __declspec(dllexport)#else#define LINKAGE __declspec(dllimport)#endif
Yes, yes... I didn't write that but I know that... I use some think like that in my project.
I can not do that in this way that you propose. If I do that I will need to edit about teen files... this is to much work for me and doesn't look good. But your idea is very good... I learnt a lot from you.
"
I found another way to resolve my problem.
Thats's Good,
I hope you learned from the experience. I also hope that you learned to state a problem consisely on the project. You started off with a Non Starter Concept in that DLL Header files are different from Ordinary Header Files. They are NOT. Had you not tried to fly in the face of reason, and stated your problem more clearly, it would not have taken the resources expended to formulate an answer.
Bram van Kampen
|
|
|
|
|
Member 4608927 wrote: I writting a dll interface and I need put some function in headers files to
give probability to write some customs classes for other people.
No such need at all! just keep these functions in a cpp file and export them. Works all the time. The custom classes should be derived from your base classes in the DLL. It would be bad practice to try to do things by modifying your DLL header to customise things.
regards
Bram van Kampen
|
|
|
|
|
You are violating the One Definition Rule (ODR)[^]. There are three ways around this:
The first is to move the function definition into the class definition (such functions are implicitly inline ):
class A
{
public:
virtual void foo()
{
}
};
The second is to add the inline keyword to the function definition in your code as is:
class A
{
public:
virtual void foo();
};
inline void A::foo()
{
}
The third is to move the definition of the member function into a .CPP file:
class A
{
public:
virtual void foo();
};
void A::foo()
{
}
Also note that it's pointless to use the inline keyword on virtual functions as virtual functions need an address to put in the vtable[^] and thus will not be inlined anyway.
|
|
|
|
|
Hi,
I am using the IXMLDOM objects to create an xml file and write tags to this file.
I would like to create a tag <children count="2">, and under that write the names of the children <childname> value </childname>.
this should look as folowing:
<Root>
<Person>
<Name> value </Name>
<PhoneNumber> value </PhoneNumber>
<Children count = 2>
<childName> value </childName>
<childName> value </childName>
</Children>
</Person>
</Root>
1. Using IXMLDOMDocument or IXMLDOMNode, how do I add a node <Children count =2>, is this an attribute? How do I make sure that it is inserted under the <phonenumber> tag?
2. How do I add the sub nodes underneath <childName> value </childName>
If you could give me code examples tha twould be great.
I've tried all kinds of options using the IXMLDOM functiom and it doesn't work!!
Thanks.
modified on Tuesday, July 1, 2008 12:51 PM
|
|
|
|
|
SWDevil wrote: I've tried all kinds of options using the IXMLDOM functiom and it doesn't work!!
Have you tried reading the documentation[^]?
led mike
|
|
|
|
|
umm.. yes...
obviously it did not help much, therfore I wrote this post...
|
|
|
|
|
At the bottom of the page i posted click on the links to createElement and appendChild
led mike
|
|
|
|
|
In MDI Application i want only maximise and close button on my child windows and not minimise button.
I tried diff styles of the window in "PreCreateWindow" function, but i could disable the minimise button but couldnt hide it.
Is it because Window property has this limitation?
Can you please help?
Thanks
Regards,
Jigna
|
|
|
|
|
To my knowledge, it cannot be removed without also removing the entire caption.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I am using com dll with some clsid . I do know the source code . is there any way to change the
clsid of this com dll .
Rajesh
|
|
|
|
|
You shouldn't.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
vote 5 for gray man.
|
|
|
|
|
I really cannot understand voting down, this time.
CLSID of an existing COM interface should NEVER change. Like the interface itself.
Anyway, thank you friend.
(BTW Why gray man?)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I think 1 was of a gold member because your rate is 3 if it was of a bronze member now it was 3.67(of course its my mind ) and thats right never changed and why gray 1=gray man and 5=red man ).
|
|
|
|
|
My vote too, but the score didn't go way too much up as expected. Sad buggers vote down for no reason.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Visual C++ MVP
|
|
|
|
|
Of course, but you haven't supplied anywhere near the amount of information for us to help. For example, what framework did you use (if any) to make the DLL?
Steve
|
|
|
|
|
this is simple sdk(not MFC) com dll.
Rajesh
|
|
|
|
|
How do I convert from std::string to char* in C++?
|
|
|
|
|
std::string s = "Hello World";
char* psz = s.c_str();
|
|
|
|
|
I followed the same method. But the following code:
std::string path = dtCore::GetDeltaRootPath();
const char* exeroot = path.c_str();
strcat(path,"/");
strcat(path,"CharacterAnimation.exe");
result = system(path);
return true;
gives me the following errors:
error C2664: 'strcat' : cannot convert parameter 1 from 'std::string' to 'char *'
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
.\GUI.cpp(195) : error C2664: 'strcat' : cannot convert parameter 1 from 'std::string' to 'char *'
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
.\GUI.cpp(196) : error C2664: 'system' : cannot convert parameter 1 from 'std::string' to 'const char *'
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
How do I resolve?
|
|
|
|
|
why are you using path instead of exeroot you just allocated ?
it's obvious you don't read error messages, or you don't understand what you're doing...
check your code again.
std::string path = dtCore::GetDeltaRootPath();
const char* exeroot = path.c_str();
strcat(exeroot, "/");
strcat(exeroot, "CharacterAnimation.exe");
result = <font color="red">system</font>(exeroot);
return <font color="red">true</font>;
BTW, you seem not to have takenn in account my previous remarks...
|
|
|
|
|
Now this line shows:
char* exeroot = path.c_str();
the following error.
error C2440: 'initializing' : cannot convert from 'const char *' to 'char *'
|
|
|
|
|
T.RATHA KRISHNAN wrote: char* exeroot = path.c_str();
add const then, as std::string::c_str() returns const char*
|
|
|
|
|
I think you'll get buffer overruns that way.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|