| |

VerySource

 Forgot password?
 Register
Search
View: 4912|Reply: 30

Can masters embed C language into C #

[Copy link]

1

Threads

5

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-1-26 20:40:01
| Show all posts |Read mode
Because I do n’t know how to develop UI with C, but the application must use C,
So this question

Or can C header files be referenced in C #

Thank you all for your answers
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-2-18 14:30:01
| Show all posts
Just write a DLL and call it to .net.
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 Invalid IP Address

Post time: 2020-2-18 16:45:02
| Show all posts
Written as DLL
Reply

Use magic Report

0

Threads

2

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 Hong Kong

Post time: 2020-2-18 20:45:02
| Show all posts
"Embedding" is definitely not working. . .

You can write "standard Dll" in C and use C # to call it. .
Reply

Use magic Report

0

Threads

10

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

Post time: 2020-2-18 21:00:01
| Show all posts
Can't ...
The solution is the same as above.
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-2-20 00:30:01
| Show all posts
This is a c # call to c ++ to see if it helps you
Use namespace:
using System.Runtime.InteropServices;
using System.Text;

///////////////////////////////////////////////////////// ///////////////////
Put the dll in the corresponding bin directory

Declare the dll:
[DllImport ("msDll.dll")]
public static extern int CalculateStr (StringBuilder szExp, out double pfOut, StringBuilder szErr, int nErrLen);

Instructions:
StringBuilder strT1 = new StringBuilder (100);
double fResult = 0;
int nRet;
StringBuilder szErr = new StringBuilder (30);
strT1.Append ("1 / sin90");

nRet = CalculateStr (strT1, out fResult, szErr, 30);
if (nRet == 1)
{
Response.Write (fResult);
}
else
{
Response.Write (szErr);
}

///////////////////////////////////////////////////////// ///
Reply

Use magic Report

0

Threads

6

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

Post time: 2020-2-20 21:45:01
| Show all posts
unsafe programming
Reply

Use magic Report

1

Threads

5

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

 Author| Post time: 2020-2-21 11:15:02
| Show all posts
It ’s like this, I have a lot of structure definitions in a header file,
I do n’t want to manually switch to C # because the equipment provider may change.

I wonder if I can reference this header file in C #
Reply

Use magic Report

0

Threads

5

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 United States

Post time: 2020-2-21 13:30:01
| Show all posts
Good idea
Reply

Use magic Report

1

Threads

5

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

 Author| Post time: 2020-2-21 16:00:01
| Show all posts
ms said that C # borrows the ideas of java, but how can this not work? java can be embedded in c
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list