Thread: Calling C .lib functions from C#

  1. #1
    Registered User
    Join Date
    Sep 2012
    Posts
    4

    Calling C .lib functions from C#

    I am using Visual Studio 2015. I am writing a C# program. I want to use a .LIB where the functions are written in C.

    I have searched for this but only find information on calling C code which exists in a DLL.

    Is there a way to call C code which exists in a .LIB?

    If so can you please give a short example?

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    37,600
    Most things lead to answers something like this.
    [Solved] How to use c++ static library in c# ? - CodeProject
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Sep 2012
    Posts
    4
    Quote Originally Posted by Salem View Post
    Most things lead to answers something like this.
    [Solved] How to use c++ static library in c# ? - CodeProject
    Thanks, so the only way is to create a DLL. I can do that since I have all the source.

    But there are #include's required to use the DLL. How are C #include's specified in C#?

  4. #4
    Gawking at stupidity
    Join Date
    Jul 2004
    Location
    Oregon, USA
    Posts
    3,218
    But there are #include's required to use the DLL.
    You can't make it so the DLL requires #includes to work. I'm not even really sure what you mean by that. #include files don't contain C# code, so how would C# be able to use them?

    Can you give an example of what you mean?
    If you understand what you're doing, you're not learning anything.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Calling C++ functions from C
    By mlupo in forum C++ Programming
    Replies: 8
    Last Post: 07-11-2009, 06:32 AM
  2. Calling functions
    By Kreathyr in forum C++ Programming
    Replies: 16
    Last Post: 02-23-2009, 01:09 PM
  3. Calling Functions
    By Jackson_D in forum C Programming
    Replies: 5
    Last Post: 03-14-2008, 10:47 AM
  4. Help calling and using a functions
    By method in forum Windows Programming
    Replies: 0
    Last Post: 07-08-2006, 04:08 PM
  5. I need some help on calling other functions in C
    By Unregistered in forum C Programming
    Replies: 1
    Last Post: 04-23-2002, 12:07 PM

Tags for this Thread