473,326 Members | 2,196 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Calling a C Function from CSharp

Is there someone who can tell me how to call a piece of legacy code written in C from a CSharp program? I downloaded Eric Gunnerson's stuff and it doesn't work

I want to reuse a string manipulator which was written in C in ancient times to operate on some strings I am reading with a C# program I'm working on now.
Nov 16 '05 #1
4 1058
Use PInvoke, MC++, or wrap the lagacy code within a COM component.
The MSDN contains tons of information on these topics.

Niki

"JimT" <ji********@ieee.org> wrote in
news:1B**********************************@microsof t.com...
Is there someone who can tell me how to call a piece of legacy code written in C from a CSharp program? I downloaded Eric Gunnerson's stuff and
it doesn't work.
I want to reuse a string manipulator which was written in C in ancient

times to operate on some strings I am reading with a C# program I'm working
on now.
Nov 16 '05 #2
Well if it is a routine in a DLL you can use the [DLLImport("mydll.dll")] attribute on a method that defines that routine

Or you can port it :)
Nov 16 '05 #3
Just post the code that isn't working, I'm sure we can help you out.

Willy.

"JimT" <ji********@ieee.org> wrote in message
news:1B**********************************@microsof t.com...
Is there someone who can tell me how to call a piece of legacy code
written in C from a CSharp program? I downloaded Eric Gunnerson's stuff
and it doesn't work.

I want to reuse a string manipulator which was written in C in ancient
times to operate on some strings I am reading with a C# program I'm
working on now.

Nov 16 '05 #4
Hello Jim,

I was reviewing the thread. Have the problem beem resolved by the
community's suggestion? If there is any we can do, please feel free to post
here.

Thanks very much.

Best regards,
Yanhong Huang
Microsoft Community Support

Get Secure! ¨C www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 16 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: The_King | last post by:
Hello all: I was wondering if anyone has tried (and got to work) calling a c#.net ..dll from VBA code? I have been working on this for about 2 weeks and am not getting any where. The_King
2
by: Tony Liu | last post by:
Hi, I want to get the name of the calling function of an executing function, I use the StackTrace class to do this and it seems working. However, does anyone think that there any side effect...
11
by: Ken Varn | last post by:
I want to be able to determine my current line, file, and function in my C# application. I know that C++ has the __LINE__, __FUNCTION__, and __FILE___ macros for getting this, but I cannot find a...
2
by: Pawan Aggarwal | last post by:
I'm having trouble with calling an exported function in a native DLL compiled with eMbedded Visual C++ in C# application in PocketPC 2002 OS. Problem Description follows: I have one exported...
1
by: Paul J Barrett | last post by:
I have a problem with the marshaller calling a vb6 dll from csharp. here follows the code that is similar in structure to what i want to call. rem vb6 dll type a b1 as byte b2(2) as byte...
3
by: Giri | last post by:
Does anyone know if there is a XIRR function in the Framework somewhere? Or, if not, maybe a link to something that I could convert into a function.. Thanks
3
by: RC | last post by:
Hi, I have a dll written by vb6. AFunction(ByRef o as Variant) I want to use it in csharp by System.Reflection. Assembly asm = Assembly.LoadFrom("Lib.dll"); Type t =...
0
by: ajitgoel | last post by:
Hi; We have a Javascript function which I have been tasked to move to a CSharp class. This javascript function uses Regular expression extensively. This function has a string input parameter and...
6
by: Ajit Goel | last post by:
Hi; We have a Javascript function which I have been tasked to move to a CSharp class. This javascript function uses Regular expression extensively. This function has a string input parameter and...
6
by: sasha | last post by:
I have a c++ code that callls csharp. Now I want to be able to pass a function pointer from C++ to Csharp code and have c# callback to it. Is it possible and how? Here is what I have so far :...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.