Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / September 2007

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
weird0 - 09 Sep 2007 17:25 GMT
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.
Nicholas Paldino [.NET/C# MVP] - 09 Sep 2007 17:44 GMT
weird0,

   See inline:

> 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
[quoted text clipped - 5 lines]
> 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

Signature

         - Nicholas Paldino [.NET/C# MVP]
         - mvp@spam.guard.caspershouse.com

> Would be really thankful personally, and it will be great help for
> the students of this course project.
Nicholas Paldino [.NET/C# MVP] - 09 Sep 2007 18:02 GMT
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.

Signature

         - Nicholas Paldino [.NET/C# MVP]
         - mvp@spam.guard.caspershouse.com

> weird0,
>
[quoted text clipped - 31 lines]
>> Would be really thankful personally, and it will be great help for
>> the students of this course project.
Sheng Jiang[MVP] - 09 Sep 2007 19:21 GMT
You can write managed wrapper classes in a mixed assembly using C++/CLI.

Signature

Sheng Jiang
Microsoft MVP in VC++

> 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
[quoted text clipped - 11 lines]
>  Would be really thankful personally, and it will be great help for
> the students of this course project.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.