CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Jun 2009
    Location
    Italy
    Posts
    41

    call native c++ function or class

    hi i would use and call native c++ function or class member present in a .h or .cpp file in the resource of a window form c++ clr project...
    i would that in form1.h file, after a button click i would call a function present in a .h file developed in native c++.
    it is possible?

  2. #2
    Join Date
    Jul 2002
    Posts
    2,543

    Re: call native c++ function or class

    Yes, this is possible. Native functions and classes are called from C++/CLI exactly like from C++. Include h-file with function prototype or class definition, and call them.

  3. #3
    Join Date
    Jun 2009
    Location
    Italy
    Posts
    41

    Re: call native c++ function or class

    mmm but i include .cpp or .h file in file of main function and in form.h after a mouse click event i try to create a new class or call a function of cpp or h file and it give me an error...
    it tell not inizialized function

  4. #4
    Join Date
    Jan 2002
    Location
    Scaro, UK
    Posts
    5,940

    Re: call native c++ function or class

    (1) Add the cpp to the project.
    (2) Add #include <header file> to the top of Form1.h

    Then you can use the definitions in the header file in your class.

    I still think you're trying to run before you can walk here. You are lacking a basic understanding of how C++ works - so should learn the fundamentals first before trying to write C++/CLI code.

    At this rate you might learn C++/CLI before the next century... it really would be quicker if you bought a native C++ book and went through it. Or go through a native C++ online tutorial.

    Darwen.
    www.pinvoker.com - PInvoker - the .NET PInvoke Interface Exporter for C++ Dlls.

  5. #5
    Join Date
    Jul 2002
    Posts
    2,543

    Re: call native c++ function or class

    It is also a good idea to post some code which is not compiled, with compiler error messages. Finally, it is all about code

  6. #6
    Join Date
    Jun 2009
    Location
    Italy
    Posts
    41

    Re: call native c++ function or class

    ok i'll try to do this.
    i've studied c++ native code to develop win32 console application...now i'm studing cli language.
    i'm trying to integrate native cpp files with function and class yet developed for c++ native console application to window form project..
    later i'll post same code
    tnx to everyone

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured