Generating code(.dll), Ice integration problem

KruppyKruppy Member Yuri KruppOrganization: Eljaco IncProject: Grid Query tool ✭✭
Hello,
The project I am working on is the DLL with MFC used as a static library, also statically linked to third parties MFC extension libraries.
Once I set Properties/Code Generation/Runtime library as Multi-threaded DLL, I have got many "...already defined in msvcrt.lib(MSVCR71.dll)" errors.
How can I get Ice integrated?
Thanks
Yury

Comments

  • beaglesbeagles Member Brent EaglesOrganization: Eagles Technologies IncProject: Asterisk SCF ✭✭✭
    What you are experiencing is the result of trying to link object files or libraries that were built using different runtime library settings. Ice is currently built as a DLL and uses the DLL version of the Microsoft runtime library and the static libraries you are using were likely built with the static version of the runtime library.

    How do you solve your problem? Sadly, the only thing I would suggest is to see if you can obtain DLL versions of the the third party MFC extensions and use the MFC DLL library instead. Depending on what your DLL is doing, this might be better for you in the long run anyway. As I recall, there are memory management issues with DLLs that use the static runtime library. Some of my colleagues have had some experience with this and may have some additional comments.

    Cheers,
    Brent
  • KruppyKruppy Member Yuri KruppOrganization: Eljaco IncProject: Grid Query tool ✭✭
    sample MFC client?

    Brent,
    Thank you for review.
    Do you have any sample MFC(GUI) client app wich integrates with Ice?
    Sincerely
    Yury
  • michimichi Member Michi HenningOrganization: Triodia TechnologiesProject: I have a passing interest in Ice :-) ✭✭✭
    Have a look at the demo/Ice/MFC directory. That should get you started.

    Cheers,

    Michi.
  • matthewmatthew NL, CanadaMember Matthew NewhookOrganization: ZeroC, Inc.Project: Internet Communications Engine ✭✭✭
    As a warning the server demo has a big bug.

    You may not write to MFC UI objects in a thread other than main. This demo does exactly this -- since it writes directly to a CEdit in a method invocation on the hello object, and in the logger. The hello object method, if called as a result of an RPC, will always be called in a thread other than main. The logger methods may be called in a thread other than main.

    This bug is fixed in Ice 2.2.

    Regards, Matthew
  • KruppyKruppy Member Yuri KruppOrganization: Eljaco IncProject: Grid Query tool ✭✭
    MFC/Ice client implementation, smart pointer as member variable problem

    Thanks for response,
    One specific question:
    I have implemented the client integration the way MFC sample app does:
    the dialog box gets initialized with the connector pointer as a parameter, and the interface proxy is initializing within the OnInitDialog().
    The client basically creates the request and on ButtonClick() makes the server call to retrieve the response:

    m_Response = m_PrxExecutor->execute(request);

    Can the response object smart pointer be a dialog box's member variable in order to reuse the response in different scope? Or a copy of the underlying instance should be made?

    Once the response pointer is a member variable, I have an exception within ~Handle() ( hanlde.h ) when dialog box is closing. I assume some Object pointer exists, but not the object (and deletion cannot be made).

    Am I doing something wrong?

    Thank you in advance
    Yury
  • matthewmatthew NL, CanadaMember Matthew NewhookOrganization: ZeroC, Inc.Project: Internet Communications Engine ✭✭✭
    There is no reason why the smart pointer cannot be a member. As to why you get an exception in ~Handle, I'm not really sure. Did you try purify (or similar tool) to try to find a memory problem?

    If you post a self-contained complete example that demonstrates this problem we'll try to give you a hand.

    Matthew
Sign In or Register to comment.