none
Problem with Managed C++ RRS feed

Answers

  • OK, I believe the other thread (with code) which I just merged was your motivation ... so here we go:

    1) You can use #define in Managed C++ (or better C++/CLI), but it will be visible only from native code in your C++ projects, it won't be accessible from managed code. If you need to use IOMNI_ALARM and IOMNI_IQSERVICE_STOPPED, use enumeration in managed code, or use static constant fields for the values.
    2) For enum ... use managed enumeration type (see #1).
    3) If you need t_Point to be visible in managed code, you need to make it a managed type (value struct) - see e.g. here.

    All these questions are covered by C++/CLI tutorials like this one.

    -Karel
    Monday, December 21, 2009 5:22 PM
    Moderator

All replies

  • #ifndef _IOMNILIB_DLL
    #ifdef WIN32
    #include "windows.h"
    #endif
    #endif
    
    #ifndef _IOMNILIB_INTERFACE_H_
    #define _IOMNILIB_INTERFACE_H_
    /**
    * Defines Return codes definitions
    * This is the definition of all return codes
    **/
    #define IOMNI_ALARM 3 // The IQ server is returning alarm(s)
    #define IOMNI_IQSERVICE_STOPPED 
    
    enum IOMNILIB_IMAGEFORMAT 
    {
        IOMNILIB_BMP = 0,
        IOMNILIB_JPEG
    };
    
    typedef struct t_Point {
        int x; //Represents the image width axis
        int y; //Represents the image height axis
    } IOMNILIB_POINT;
    
    int DllEntry iOmniAttachIQServer(
        const char* szIpAddr, 
        const char* szUserName, 
        const char* szPassword);

     

    Monday, December 21, 2009 3:13 AM
  • Please ask your question more clearly. Take a look at this, it explains how you should ask your questions here.
    Geert van Horrik - CatenaLogic
    Visit my blog: http://blog.catenalogic.com

    Looking for a way to deploy your updates to all your clients? Try Updater!
    Monday, December 21, 2009 10:55 AM
  • #define, enum and typedef struct are C++ constructs which are included also in Managed C++.
    So the answer is: You can do them the same way as in C++.

    If this didn't help, please be more specific and post motivation for your question. And why do you think it doesn't work the same way in Managed C++ as in C++.

    -Karel
    Monday, December 21, 2009 5:06 PM
    Moderator
  • OK, I believe the other thread (with code) which I just merged was your motivation ... so here we go:

    1) You can use #define in Managed C++ (or better C++/CLI), but it will be visible only from native code in your C++ projects, it won't be accessible from managed code. If you need to use IOMNI_ALARM and IOMNI_IQSERVICE_STOPPED, use enumeration in managed code, or use static constant fields for the values.
    2) For enum ... use managed enumeration type (see #1).
    3) If you need t_Point to be visible in managed code, you need to make it a managed type (value struct) - see e.g. here.

    All these questions are covered by C++/CLI tutorials like this one.

    -Karel
    Monday, December 21, 2009 5:22 PM
    Moderator