DLL written in C # in C + + projects using CLR

Source: Internet
Author: User

1, note: When writing the C#dll class library, it is best not to appear the same namespace, or in C + + may be called a compilation error.
2. Copy C # Source-generated "DLL" files to the debug directory in C + + project
3. Set C + + project properties to common language runtime support
4. Import DLL files and reference militia space in the project

#using". /debug/xxx.dll"usingnamespace xxxx;

5. Instantiate C # object: Cl ^CL = gcnew cl ();

6. Method of calling C # with out string[] Parameters: Intpoweroff (out string[] frameary)

array<string^>^  frameary = gcnew array<string^> (0); int result = cl->PowerOff (frameary);p rintf (" Uplink message:%s", frameary[ 0]);

7. Calling methods with int type and string type

int r = cl->initsetting (1"193.168.18.11  "1000420000);

8, call the method with int[], single[] type parameter: boolsetharmonic (int phase,int[] Int_xtswitch, single[] sng_value, single[] Sng_phase,out String[] frameary)

array<string^>^  frameary = gcnew array<string^> (0); array<float>^  Floatarray = gcnew array<float> (1); array<int> ^ Intarray = gcnew array<int> (1); int n = cl->setharmonic (1, Intarray, Floatarray, Floatarray, frameary);

DLL written in C # in C + + projects using CLR

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.