Thread: using .c file in c#

  1. #1
    Registered User
    Join Date
    Jul 2010
    Posts
    1

    using .c file in c#

    Hi,

    I have a .c file which is detecting the marker live and calculating the x and y values.

    I want to use that .c file functions in c# so that i can get the x and y values and use them for other purposes.

    So should i make a .dll file of that .c file? And what will be the pros and cons of making .dll file of that .c which is constantly detecting marker and providing values and then using them into C#?

    will there be any delay or something? And what to look before converting that .c file into .dll as that .c file is linked to 10-12 libraries.


    Please help me out.I am new to these forums and i didnt go through if its already posted or not but i m stuck badly thats why posted.Sorry for that.

    Thanks

    Mohsin

  2. #2
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    You can either declare the C functions in a sep. C# module or you can use C++/CLI and create a managed interface to use from C# which talks to the C++. C++/CLI is compatible with both C++ .NET (or any .NET language) and unmanaged C/C++.

  3. #3
    Registered User C_ntua's Avatar
    Join Date
    Jun 2008
    Posts
    1,853
    Not an expert when it comes with DLLs but can you use DllImport in C# as you use it with calling things like functions from the Win API?

    Like do
    Code:
    [DllImort("OP.dll")]
    extern static void CalcMarket(int* x, int* y, ...);
    and either use it in an unsafe class/function or do something like
    Code:
    [DllImort("OP.dll")]
    extern static void CalcMarket(ref int x, ref int y, ...);

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A development process
    By Noir in forum C Programming
    Replies: 37
    Last Post: 07-10-2011, 10:39 PM
  2. help with text input
    By Alphawaves in forum C Programming
    Replies: 8
    Last Post: 04-08-2007, 04:54 PM
  3. functions in .C file not recognized in .CPP file
    By tooKool4School6 in forum C++ Programming
    Replies: 1
    Last Post: 06-02-2006, 10:30 AM
  4. System
    By drdroid in forum C++ Programming
    Replies: 3
    Last Post: 06-28-2002, 10:12 PM
  5. Need a suggestion on a school project..
    By Screwz Luse in forum C Programming
    Replies: 5
    Last Post: 11-27-2001, 02:58 AM