Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. how to use dll created by C,C++ in C# project?

how to use dll created by C,C++ in C# project?

Scheduled Pinned Locked Moved C#
helpcsharpc++tutorialquestion
4 Posts 3 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Sachin Gedam
    wrote on last edited by
    #1

    Hello Friends, Our clients requirement is that we have to use their DLL which is created by C,C++ code. What I am doing in my code is that : 1. using using System.Runtime.InteropServices; 2. [DllImport(@"g:\SampleDLL.dll",EntryPoint="test", SetLastError=true, CharSet=CharSet.Unicode, CallingConvention=CallingConvention.Winapi)] 3. static extern int test(int lpLibName); 4. and in code calling test function with parmeter as 10. But I am getting error that entry point "test" not found in SampleDll.dll, but this methods defination written in that dll itself. Please help me out of this. Or tell me is there any other way to use that dll? Sachin Gedam (Software Engg.) Pune India

    S 1 Reply Last reply
    0
    • S Sachin Gedam

      Hello Friends, Our clients requirement is that we have to use their DLL which is created by C,C++ code. What I am doing in my code is that : 1. using using System.Runtime.InteropServices; 2. [DllImport(@"g:\SampleDLL.dll",EntryPoint="test", SetLastError=true, CharSet=CharSet.Unicode, CallingConvention=CallingConvention.Winapi)] 3. static extern int test(int lpLibName); 4. and in code calling test function with parmeter as 10. But I am getting error that entry point "test" not found in SampleDll.dll, but this methods defination written in that dll itself. Please help me out of this. Or tell me is there any other way to use that dll? Sachin Gedam (Software Engg.) Pune India

      S Offline
      S Offline
      spif2001
      wrote on last edited by
      #2

      It's COM you're after. Here's a little appetizer http://www.codeproject.com/dotnet/cominterop.asp

      S 1 Reply Last reply
      0
      • S spif2001

        It's COM you're after. Here's a little appetizer http://www.codeproject.com/dotnet/cominterop.asp

        S Offline
        S Offline
        Sachin Gedam
        wrote on last edited by
        #3

        sorry but its not a COM object, its simple a compiled dll created by old school level C,C++ language. And we have to use that dll in our .net project. Sachin Gedam (Software Engg.) Pune India

        D 1 Reply Last reply
        0
        • S Sachin Gedam

          sorry but its not a COM object, its simple a compiled dll created by old school level C,C++ language. And we have to use that dll in our .net project. Sachin Gedam (Software Engg.) Pune India

          D Offline
          D Offline
          DavidNohejl
          wrote on last edited by
          #4

          Unmanaged calls are not only COM. PInvoke is keyword to search for. PInvoke C# Tutorial[^] David Never forget: "Stay kul and happy" (I.A.)
          David's thoughts / dnhsoftware.org / MyHTMLTidy

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups