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 / .NET Framework / Interop / March 2007

Tip: Looking for answers? Try searching our database.

How to include header file used by DLL

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Dv - 16 Mar 2007 15:09 GMT
I have a API lib (written in C/C++) that can be used by C/C++ project.
Now, I'm adding support to C# project.

I changed the Lib to DLL. This is easy. However, I have no idea how to
deal with the structures and constants that used to be defined in the
header file of the lib.

Where should I define them that they can be commonly used by the DLL, C
++ and C#, and also is readable to their developers from their IDEs?

Thanks!
-Dev
SimeonArgus - 16 Mar 2007 15:32 GMT
> I have a API lib (written in C/C++) that can be used by C/C++ project.
> Now, I'm adding support to C# project.
[quoted text clipped - 8 lines]
> Thanks!
> -Dev

I think I understand the question. By default, the C# engine will know
how to comile your existing function calls, constants, etc based on
the DLL.

However, if you want those constants to pop up in the intellisense
menus, then you may be pushing your luck. It won't auto-load them into
Intellisense for you.

Instead, you may want to create new declarations in C# as constants
that mimic your C++ constants. The problem is that now you have two
sets of "constants" to maintain.

Hope that helps.

--Sim
Dv - 16 Mar 2007 17:00 GMT
> > I have a API lib (written in C/C++) that can be used by C/C++ project.
> > Now, I'm adding support to C# project.
[quoted text clipped - 24 lines]
>
> --Sim

Sim, thanks for your reply! No, I didn't mean the Intellisense. I
meant a text file (instead of a binary file, such as DLL) that is
displayable in IDE with all the structures and constants defined in
there.

I expect that users of my DLL could reuse the declarations coming with
the DLL either in the form of header file or some other way that's
acceptable by both C++ and C#.
Nicholas Paldino [.NET/C# MVP] - 18 Mar 2007 02:13 GMT
Dv,

   You can't.  You have to declare the structures that the functions use in
C#.  Your best bet would be to declare them in the assembly that utilizes
the DLL functions in C#.

   You can not use the same header file in C++ as you do in C#, and
vice-versa.

   Hope this helps.

Signature

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

>I have a API lib (written in C/C++) that can be used by C/C++ project.
> Now, I'm adding support to C# project.
[quoted text clipped - 8 lines]
> Thanks!
> -Dev

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.