Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

Importing Dll's To C#

import

  • Please log in to reply
5 replies to this topic

#1 Tonchi

Tonchi

    Helping the world with programming

  • Expert Member
  • PipPipPipPipPipPipPip
  • 1249 posts
  • Location:Zagreb
  • Programming Language:C#, Others
  • Learning:C, C++, Python, JavaScript, Transact-SQL, Assembly

Posted 02 May 2012 - 09:01 AM

I have a question for my future project. I will not go into details because I don't want to talk about it. What I want to ask is that is it possible to make application in C# which will import dll's from C code for microchip and that code must have the same funcionality when I import it to C# application. Of course that microchip will be connected to computer all the time.
  • 0

Microsoft Student Partner, Microsoft Certified Professional


#2 Orjan

Orjan

    CC Mentor

  • Moderator
  • 2918 posts
  • Location:Karlstad, Sweden
  • Programming Language:C, Java, C++, C#, PHP, JavaScript, Pascal
  • Learning:Java, C#

Posted 02 May 2012 - 10:06 AM

A dll is a dll, no matter which language you use. Just have to know how to link it...
  • 0

I'm a System developer at XLENT Consultant Group mainly working with SugarCRM.
Please DO NOT send mail or PM to me with programming questions, post them in the appropriate forum instead, where I and others can answer you.


#3 Tonchi

Tonchi

    Helping the world with programming

  • Expert Member
  • PipPipPipPipPipPipPip
  • 1249 posts
  • Location:Zagreb
  • Programming Language:C#, Others
  • Learning:C, C++, Python, JavaScript, Transact-SQL, Assembly

Posted 02 May 2012 - 10:17 AM

i know how to link it...there is a huge amount of sites where people explein the process but I'm not asking that. I only want to know if that DLL will work in running C# program and of course that iron box which will contain solder circuit board with microchip on it. I want to manage that microchip which will send signals to my C# program which contains C DLL. Try not to see my post as attack or some kind of anger, I only don't know how to explain it in some other way :)
  • 0

Microsoft Student Partner, Microsoft Certified Professional


#4 kernelcoder

kernelcoder

    CC Devotee

  • Expert Member
  • PipPipPipPipPipPip
  • 990 posts
  • Location:Dhaka
  • Programming Language:C, Java, C++, C#, Visual Basic .NET
  • Learning:Objective-C, PHP, Python, Delphi/Object Pascal

Posted 02 May 2012 - 07:08 PM

As far as I know, the only way to call unmanaged function implemented in a C/C++ DLL from C# managed code is using PInvoke (DllImport Attribute). -- http://msdn.microsof...8(v=vs.71).aspx

There is another way too (the COM interop), but your unmanaged code needs to be aware that (you code need to be a COM server)--- well, that is a different story.
  • 0

#5 Luthfi

Luthfi

    CC Leader

  • Expert Member
  • PipPipPipPipPipPipPip
  • 1320 posts
  • Programming Language:PHP, Delphi/Object Pascal, Pascal, Transact-SQL
  • Learning:C, Java, PHP

Posted 03 May 2012 - 09:41 PM

i know how to link it...there is a huge amount of sites where people explein the process but I'm not asking that. I only want to know if that DLL will work in running C# program and of course that iron box which will contain solder circuit board with microchip on it. I want to manage that microchip which will send signals to my C# program which contains C DLL. Try not to see my post as attack or some kind of anger, I only don't know how to explain it in some other way :)


I think there is no one consider your post is attacking or raising anger. No problem with your post.

On the subject you are asking/wondering, the answer is yes. Consider dll-s as blackboxes. You don't have to know their internals. Just use the interface they provided (i.e. the exported routines) with data of proper format and proper value, and they will spit out consistent result.
  • 0

#6 Tonchi

Tonchi

    Helping the world with programming

  • Expert Member
  • PipPipPipPipPipPipPip
  • 1249 posts
  • Location:Zagreb
  • Programming Language:C#, Others
  • Learning:C, C++, Python, JavaScript, Transact-SQL, Assembly

Posted 04 May 2012 - 12:40 AM

tnx a lot
  • 0

Microsoft Student Partner, Microsoft Certified Professional






Also tagged with one or more of these keywords: import

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download