how to get the reference of the object in C++

This is a discussion on how to get the reference of the object in C++ within the Windows Programming forums, part of the Platform Specific Boards category; hi, I am writing a C++ library using managed extensions, i am trying to get the reference of one of ...

  1. #1
    Registered User
    Join Date
    Mar 2008
    Posts
    6

    how to get the reference of the object in C++

    hi,
    I am writing a C++ library using managed extensions, i am trying to get the reference of one of the System Drawing Bitmap object
    the code looks like this:

    System:: Drawing::Bitmap __gc*bmp;
    System:: Drawing::Bitmap __gc* __gc* ptrBmp; //suppose to be the ref to the bitmap object

    ...initialize the bitmap object ....

    //try to assign the bitmap object bmp to ptrBmp
    (*ptrBmp) = bmp //program will stuck here
    although the actual code pas the compilation, but the program will stuck at the point shown in the code, can you guys help me out?? thanks

  2. #2
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,548
    You're not supposed to use * for managed objects.
    I think it's ^ for pointers and % for references or something like that.
    Retarded syntax, I know.
    How you dereference or such I don't know.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  3. #3
    Registered User
    Join Date
    Mar 2008
    Posts
    6
    hi, thanks for the reply. i have tried to use "^" pointer and "%" reference, but my compiler seems doesn't recognize them.
    i am using Visual C++ 2003, is that means i can not use "^%"??

    Thanks

  4. #4
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,548
    Perhaps you are using an old version of C++ .NET? That's not standard, so I suggest you update compiler to 2008 instead.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  5. #5
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    2003 doesn't support C++/CLI, only Managed Extensions for C++. That pseudo-language was ill-designed, buggy, and is now dead, so don't bother learning it. If you really want C++ and .Net interaction, get the newest VS Express edition and use C++/CLI. It's a lot easier on the eyes.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  6. #6
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,548
    I think it's perhaps a lot strainful on the eyes. The syntax is horrible. But it's at least standard as compared to this, so it's highly recommended.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  7. #7
    Registered User
    Join Date
    Mar 2008
    Posts
    6
    thanks for the reply.

    now they ask me to use windows build-in library to solve the problem, so everything will be fairly easy now.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to maintain and return local object reference?
    By benshi in forum C++ Programming
    Replies: 14
    Last Post: 12-16-2007, 01:17 PM
  2. Managing a reference object
    By Mario F. in forum C++ Programming
    Replies: 4
    Last Post: 11-23-2006, 06:41 PM
  3. Question about OpenGL/Linux
    By Ideswa in forum Linux Programming
    Replies: 12
    Last Post: 09-10-2006, 05:56 AM
  4. Strange/false errors
    By Ganoosh in forum Windows Programming
    Replies: 8
    Last Post: 10-20-2005, 04:54 PM
  5. Beginners guide to OOP from a Java background?!
    By eggsy84 in forum C++ Programming
    Replies: 6
    Last Post: 06-08-2005, 06:13 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21