-
June 17th, 2013, 01:50 PM
#1
Problem using wstring converted from char * in dll class
I have attached a demo app. A lengthy post was lost by the server.
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.
Last edited by Mike Pliam; June 17th, 2013 at 02:38 PM.
mpliam
-
June 17th, 2013, 02:16 PM
#2
Re: Problem using wstring converted from char * in dll class
>> I have attached a demo app.
I don't see it.
gg
-
June 17th, 2013, 03:48 PM
#3
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;
Best regards,
Igor
-
June 18th, 2013, 11:50 AM
#4
Re: Problem using wstring converted from char * in dll class
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.
mpliam
-
June 18th, 2013, 11:51 AM
#5
Re: Problem using wstring converted from char * in dll class
Originally Posted by Codeplug
>> I have attached a demo app.
I don't see it.
gg
Everything is t- t- t- timing!
mpliam
-
June 18th, 2013, 01:58 PM
#6
Re: Problem using wstring converted from char * in dll class
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.
Last edited by Igor Vartanov; June 18th, 2013 at 02:06 PM.
Best regards,
Igor
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|