Thread: C# DLL in C code, is it possible?

  1. #1
    Registered User
    Join Date
    Apr 2016
    Posts
    2

    Lightbulb C# DLL in C code, is it possible?

    Hello!

    I'm trying to investigate if its possible to call methods in a DLL made with C# in a simple C program. I have little experience in Windows programming, I've done a lot under Linux environments though.

    I need to use logic implemented in C# in a C program to avoid porting the whole thing to C / C++, which would of course be possible but way too time consuming for the project I'm trying to do.

    Basically I'm trying to deserialise C# data tables (DataTable type) that have been serialised to byte vectors. The serialiser/deserialiser is implemented in C# and can output the deserialised data to JSON which I would like to pass to an Erlang program.

    So C program would input a char buffer to the method in the C# DLL, the method would return a pointer to a char buffer (hopefully )
    If I can achieve this I can pass the data back to Erlang using a driver or NIF and interpret the JSON encoded data.

    What do you guys think, would this be possible?

  2. #2
    Programming Wraith GReaper's Avatar
    Join Date
    Apr 2009
    Location
    Greece
    Posts
    2,738
    This is a (seemingly) complete guide given by microsoft:
    https://support.microsoft.com/en-us/kb/828736

    it's about C++, but I think you can use it with C too. The C# DLL has to be compiled with COM etc.
    Devoted my life to programming...

  3. #3
    Registered User
    Join Date
    Apr 2016
    Posts
    2
    Thank you sir!
    I really should have found this article myself, sorry for that.

    I will try this out and let you know the outcome.

    Cheers!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 1
    Last Post: 03-10-2010, 11:28 AM
  2. Replies: 14
    Last Post: 04-01-2008, 02:23 AM
  3. producing c/c++ code from flowcharts,pseudo code , algorithims
    By rohit83.ken in forum C++ Programming
    Replies: 3
    Last Post: 02-20-2008, 07:09 AM
  4. Having trouble translating psudeo-code to real-code.
    By Lithorien in forum C++ Programming
    Replies: 13
    Last Post: 10-05-2004, 07:51 PM
  5. Replies: 0
    Last Post: 02-21-2002, 06:05 PM

Tags for this Thread