473,320 Members | 2,048 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,320 software developers and data experts.

using old header files (*.h) in c#

Hi all,
I received a number of header files of several years old in C , now I want
to use this code in c#. What are the steps I need to make? Can I compile it
into a DLL with c++ and use it in c# somehow(.net 2005) ? must I convert it
to cs files ? Is there a tool available ? Maybe examples ?
Many many and even more thanks,
--
Lu
Feb 23 '06 #1
2 2215
sounds easy .. I only have about 20 header files , some headers include the
others, .........how do I get the header files compiled correctly into .dll
s. The P/invoke transforms the .h to code with a lot of .dlls imported. But
then I have to create dll's out of these header files....how do I do that.

sorry but I'm not a c guru....anywhay thanks for yr help.
--
Lu
"Vadym Stetsyak" wrote:
Hello, Lu!

LP> Hi all,
LP> I received a number of header files of several years old in C , now I
LP> want to use this code in c#. What are the steps I need to make? Can I
LP> compile it into a DLL with c++ and use it in c# somehow(.net 2005) ?
LP> must I convert it to cs files ? Is there a tool available ? Maybe
LP> examples ? Many many and even more thanks,

What are there in headers? usually there are placed some definitions and declarations ( function prototypes, constants etc ). If you have headers, then it seems that you also have the code that uses these headers.

IMO here you have following ways:
- compile the code C with headers into separate DLL, ensuring that declared functions are exported from that dll. Then in the managed code ( C# ) you can use them via p/invoke.

- rewrite the code totally in C#.

--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot

Feb 24 '06 #2
Hello, Lu!

LP> sounds easy .. I only have about 20 header files , some headers include
LP> the others, .........how do I get the header files compiled correctly
LP> into .dll s.

What do your header files contain? only definitions .
To compile to dll you have to use compiler and linker. Or if you have Visual Studio then you can create Dll project and include there all the sources you have

P.S. P/Invoke is not transforming files. It enables you to call unmanaged functions from managed environment.

--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot.com
Feb 24 '06 #3

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

Similar topics

6
by: Eric Ellsworth | last post by:
Hi, I've been wrestling for several months now with this issue in IE: http://support.microsoft.com/?kbid=308090 (IE thinks that ZIPs sent from a script are corrupt when they are not). IE now...
16
by: matthurne | last post by:
I just started learning C++ on my own...I'm using Accelerated C++. Something it hasn't explained and I keep wondering about is how header files actually work. I suspect it doesn't get into it...
13
by: Squid Seven | last post by:
This is just bizarre. for the following snippet of code: #include <string> using std::string; I get the error message:
0
by: Richard Taylor | last post by:
User-Agent: OSXnews 2.07 Xref: number1.nntp.dca.giganews.com comp.lang.python:437315 Hi I am trying to use py2app (http://undefined.org/python/) to package a gnome-python application...
18
by: John Smith | last post by:
Hi all What does the group think of the practise of including one header file from inside another? I have some legacy code where this has been done, and it creates a dependency on a module...
1
by: Xiangliang Meng | last post by:
Hi, all. Recently, I find there is a way in our project to maintain a global set in many files by using preprocessing directives. I'm wondering if we could find a better method for this. Many...
5
by: Michael Sperlle | last post by:
Is it possible? Bestcrypt can supposedly be set up on linux, but it seems to need changes to the kernel before it can be installed, and I have no intention of going through whatever hell that would...
21
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Uploading files from a local computer to a remote web server has many useful purposes, the most...
221
Atli
by: Atli | last post by:
You may be wondering why you would want to put your files “into” the database, rather than just onto the file-system. Well, most of the time, you wouldn’t. In situations where your PHP application...
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: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
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)...
0
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: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
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...

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.