473,386 Members | 1,835 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,386 software developers and data experts.

How to work with Header files(.h) and lib files in C

Hi!all. As part of the course project in the university, students
have been given task to develop a front-end for SMILE( an API written
in C++ for network modelling). Upon extracting the setup, it gives a
collection of " Header files and Lib files" written in c++.

Now, how do i add them in c# to use the existing api to create a
front-end. I do know that we can include the reference for any .dll
file and use it. But don't know how to use existing header files and
lib files in c#.

Can somebody guide me and help me on this issue, if somebody has
worked with C++ header files or done any sort of work on SMILE.

Would be really thankful personally, and it will be great help for
the students of this course project.

Sep 9 '07 #1
3 2615
weird0,

See inline:

"weird0" <am********@gmail.comwrote in message
news:11**********************@k79g2000hse.googlegr oups.com...
Hi!all. As part of the course project in the university, students
have been given task to develop a front-end for SMILE( an API written
in C++ for network modelling). Upon extracting the setup, it gives a
collection of " Header files and Lib files" written in c++.

Now, how do i add them in c# to use the existing api to create a
front-end. I do know that we can include the reference for any .dll
file and use it. But don't know how to use existing header files and
lib files in c#.
You can't create a reference to ANY .dll file and use it. The only way
you can add a reference to a .dll file is if it is a .NET assembly, or if it
is a COM assembly (in which case, you really reference the assembly
generated by TLBIMP, the COM wrapper generator).
Can somebody guide me and help me on this issue, if somebody has
worked with C++ header files or done any sort of work on SMILE.
What you need to do is declare the types and functions that you are
going to call. In general, you are using the P/Invoke layer. Here is a
reference to get your started:

http://msdn2.microsoft.com/en-us/library/fzhhdwae.aspx

Specifically, the section on consuming unmanaged DLL functions would be
helpful as well:

http://msdn2.microsoft.com/en-us/library/26thfadc.aspx
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

Would be really thankful personally, and it will be great help for
the students of this course project.
Sep 9 '07 #2
Oh, and one other thing, if you have a .lib file, you are going to have
to create a DLL file which exposes the functions you want to call. You
can't access lib files directly from .NET.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.comwrote in
message news:1F**********************************@microsof t.com...
weird0,

See inline:

"weird0" <am********@gmail.comwrote in message
news:11**********************@k79g2000hse.googlegr oups.com...
>Hi!all. As part of the course project in the university, students
have been given task to develop a front-end for SMILE( an API written
in C++ for network modelling). Upon extracting the setup, it gives a
collection of " Header files and Lib files" written in c++.

Now, how do i add them in c# to use the existing api to create a
front-end. I do know that we can include the reference for any .dll
file and use it. But don't know how to use existing header files and
lib files in c#.

You can't create a reference to ANY .dll file and use it. The only way
you can add a reference to a .dll file is if it is a .NET assembly, or if
it is a COM assembly (in which case, you really reference the assembly
generated by TLBIMP, the COM wrapper generator).
>Can somebody guide me and help me on this issue, if somebody has
worked with C++ header files or done any sort of work on SMILE.

What you need to do is declare the types and functions that you are
going to call. In general, you are using the P/Invoke layer. Here is a
reference to get your started:

http://msdn2.microsoft.com/en-us/library/fzhhdwae.aspx

Specifically, the section on consuming unmanaged DLL functions would be
helpful as well:

http://msdn2.microsoft.com/en-us/library/26thfadc.aspx
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

>Would be really thankful personally, and it will be great help for
the students of this course project.
Sep 9 '07 #3
You can write managed wrapper classes in a mixed assembly using C++/CLI.

--
Sheng Jiang
Microsoft MVP in VC++
"weird0" <am********@gmail.comwrote in message
news:11**********************@k79g2000hse.googlegr oups.com...
Hi!all. As part of the course project in the university, students
have been given task to develop a front-end for SMILE( an API written
in C++ for network modelling). Upon extracting the setup, it gives a
collection of " Header files and Lib files" written in c++.

Now, how do i add them in c# to use the existing api to create a
front-end. I do know that we can include the reference for any .dll
file and use it. But don't know how to use existing header files and
lib files in c#.

Can somebody guide me and help me on this issue, if somebody has
worked with C++ header files or done any sort of work on SMILE.

Would be really thankful personally, and it will be great help for
the students of this course project.

Sep 9 '07 #4

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

Similar topics

3
by: dharmesh Gupta | last post by:
Hi All, i am new to header files , and have a basic question , i have made my program in three files namely, idr_bpl.cpp( contains class definitions and function definitions) bpl.cpp(...
3
by: Chris Mantoulidis | last post by:
Seperate compilation (that's what it's called, right?) seems to be quite popular, so I decided to get some info about it, and (d'oh) use it... But it's whole structure seems weird to me... ...
11
by: Steven T. Hatton | last post by:
In the past there have been lengthy discussiions regarding the role of header files in C++. People have been very adamat about header files serving as in interface to the implementation. I do...
11
by: Haro Panosyan | last post by:
My appologies, this is not directly C/C++ related. I have a C++ library, which is going to be shipped as compiled library, but the header files are going to be as source code, so people can...
11
by: ambika | last post by:
Iam just trying to know "c". And I have a small doubt about these header files. The header files just contain the declaration part...Where is the definition for these declarations written??And how...
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...
36
by: zouyongbin | last post by:
Stanley B Lippman in his "C++ Primer" that a definition like this should not appear in a header file: int ix; The inclusion of any of these definitions in two or more files of the same...
7
by: ben | last post by:
Hi, I have few doubts about header files. Is it true that header files always have only "function declaration" and not definition? Next where can i find definition of functions defined in...
1
by: weird0 | last post by:
Hi!all. As part of the course project in the university, students have been given task to develop a front-end for SMILE( an API written in C++ for network modelling). Upon extracting the setup, it...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.