Problem using wstring converted from char * in dll class
I have attached a demo app. A lengthy post was lost by the server. :mad:
Edit:
I figured it out when I built a simple demo project. Problem arose because of trying to access a c-wrapper dll from the app class whereas the wrapper class had not been initialized there but rather in the main dialog class - so naturally it didn't work!!! Anyway, I've attached the demo for any who might be interested, but I regard the problem as resolved. Shows the value of building simple projects to isolate a problem. I failed to appreciate the order in which such a program initializes - I guess it's always App first, then MainFrame, then Doc and View (I think).
Thanks.
Re: Problem using wstring converted from char * in dll class
>> I have attached a demo app.
I don't see it.
gg
Re: Problem using wstring converted from char * in dll class
Code:
CMyClass * g_pMyClass;
MY_API void StartUpMY()
{
g_pMyClass = new CMyClass();
}
MY_API void CleanUpMY()
{
delete g_pMyClass;
}
Is there any point to construct CMyClass instance explicitly with new? The code does not show any reason why that wouldn't be just:
Code:
CMyClass g_myClass;
Re: Problem using wstring converted from char * in dll class
Quote:
Originally Posted by
Igor Vartanov
Code:
CMyClass * g_pMyClass;
MY_API void StartUpMY()
{
g_pMyClass = new CMyClass();
}
MY_API void CleanUpMY()
{
delete g_pMyClass;
}
Is there any point to construct CMyClass instance explicitly with new? The code does not show any reason why that wouldn't be just:
Code:
CMyClass g_myClass;
Good point, Igor. I'll give it a try. It's just a habit that I have fallen into and had never questioned it. Thanks for your suggestion.
Re: Problem using wstring converted from char * in dll class
Quote:
Originally Posted by
Codeplug
>> I have attached a demo app.
I don't see it.
gg
Everything is t- t- t- timing! :)
Re: Problem using wstring converted from char * in dll class
Quote:
Originally Posted by
Mike Pliam
Good point, Igor. I'll give it a try. It's just a habit that I have fallen into and had never questioned it. Thanks for your suggestion.
It's just a habit to analyze every variable life cycle and everything else that might conflict with or benefit from the one. Most of the times it's trivial. But sometimes it can spare a couple of dll exports. Or couple days of debugging. :D