开发者

using .c files in C# (winform .net)

开发者 https://www.devze.com 2023-03-28 20:44 出处:网络
I am using visual studio 2010 my project is that, i want to encrypt text using blowfish algorithm and then add that encrypted data must be saved in my database

I am using visual studio 2010 my project is that, i want to encrypt text using blowfish algorithm and then add that encrypted data must be saved in my database

my blowfish algorthim is in .c file my input must be taken via C# (windows form) and my database is 开发者_开发百科in sql server 2008

i just want to known that can i send the text taken via windows form (.net c#) to my .c file and proccess it and get that encrypted data and save that data in sql server via windows form

can this be done please help me out


You'd have to compile the .c file into a DLL, and then you could use P/Invoke to create a C# binding to it


One way is to use C++/CLI as intermediary between your C and C#

C# -> C++/CLI -> C

other way is to expose your C functions and use P/Invoke in C#.


Yes. This is called interop and it can be done in various ways. One of them is called Pinvoke - you create a DLL that exports the function you want to call from c# and pinvoke will take care of the rest. I suggest you read about it in microsoft's docs.

0

精彩评论

暂无评论...
验证码 换一张
取 消