Thread: behavior of c++ dlls called from c#

  1. #1
    Use this: dudeomanodude's Avatar
    Join Date
    Jan 2008
    Location
    Hampton, VA
    Posts
    391

    behavior of c++ dlls called from c#

    Hi all,

    I'm wondering if you call something from a dll ( written in c++ ) from a c# class, does it matter if the c++ has pointers in it?

    What I'm unclear on is if C# uses "unsafe" for pointers, how does a C++ class ( with pointers ) play into that?

    Thanks in advance,

    dudeomanodude
    Ubuntu Desktop
    GCC/G++
    Geany (for quick projects)
    Anjuta (for larger things)

  2. #2
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    It's safe. C# doesn't like you using pointers to in its own code.
    C++, however, is not C# and is native, so it's fine.
    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
    Use this: dudeomanodude's Avatar
    Join Date
    Jan 2008
    Location
    Hampton, VA
    Posts
    391
    Quote Originally Posted by Elysia View Post
    It's safe. C# doesn't like you using pointers to in its own code.
    C++, however, is not C# and is native, so it's fine.
    Thaks Elysia, so does that mean their isn't any "trust" issues with programs of this nature?....
    Ubuntu Desktop
    GCC/G++
    Geany (for quick projects)
    Anjuta (for larger things)

  4. #4
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Not specifically, I don't think. The problem might be that the native code won't behave like managed code.
    No exceptions if something goes wrong and all that.
    And managed and native types don't mix too well.
    But other than that, it should be fine. dotNet was built for interop in mind.
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. when is the constructor of a global object called??
    By mynickmynick in forum C++ Programming
    Replies: 6
    Last Post: 08-28-2008, 04:57 AM
  2. Functions which return a reference
    By Stonehambey in forum C++ Programming
    Replies: 10
    Last Post: 07-05-2008, 01:43 PM
  3. DllMain not being called!
    By Yarin in forum Windows Programming
    Replies: 3
    Last Post: 06-26-2008, 09:06 PM
  4. DLLs?
    By RobotGymnast in forum C++ Programming
    Replies: 0
    Last Post: 04-28-2008, 03:35 PM
  5. How keep constructor from being called till "ready"?
    By 6tr6tr in forum C++ Programming
    Replies: 7
    Last Post: 04-23-2008, 01:20 AM