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
  1. Home
  2. General Programming
  3. C#
  4. win32 dll & c#

win32 dll & c#

Scheduled Pinned Locked Moved C#
csharphelptutorial
3 Posts 2 Posters 0 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.
  • F Offline
    F Offline
    felopater
    wrote on last edited by
    #1

    hii all, i got starnge problem. i made dll's with win32 and while i was calling them from c# application for example [DllImport("DLL.dll",EntryPoint="DLLMain")] public static extern int Sum(int x,int y); i got exception said DLLMain entry point not exists. and even when i removed it says Sum not found. even that entry point is supposed to be defined by linker. and the prototype of sum is extern int Sum(int x, int y); so why it can't see it. marcoryos

    D 1 Reply Last reply
    0
    • F felopater

      hii all, i got starnge problem. i made dll's with win32 and while i was calling them from c# application for example [DllImport("DLL.dll",EntryPoint="DLLMain")] public static extern int Sum(int x,int y); i got exception said DLLMain entry point not exists. and even when i removed it says Sum not found. even that entry point is supposed to be defined by linker. and the prototype of sum is extern int Sum(int x, int y); so why it can't see it. marcoryos

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      Your EntryPoint should be the name of the function your trying to call in the DLL. If the function name in the DLL is Sum, then the EntryPoint should specify that.

      [DllImport("DLL.dll", EntryPoint="Sum")]
      public static extern int Sum(int x, int y);

      If you wanted to change the name of the name of the function inside your application, you could do that also:

      [DllImport("DLL.dll", EntryPoint="Sum")]
      public static extern int DllSumFunction(int x, int y);

      Now, the Sum function in the DLL would be called by the name DllSumFunction in your code. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

      F 1 Reply Last reply
      0
      • D Dave Kreskowiak

        Your EntryPoint should be the name of the function your trying to call in the DLL. If the function name in the DLL is Sum, then the EntryPoint should specify that.

        [DllImport("DLL.dll", EntryPoint="Sum")]
        public static extern int Sum(int x, int y);

        If you wanted to change the name of the name of the function inside your application, you could do that also:

        [DllImport("DLL.dll", EntryPoint="Sum")]
        public static extern int DllSumFunction(int x, int y);

        Now, the Sum function in the DLL would be called by the name DllSumFunction in your code. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

        F Offline
        F Offline
        felopater
        wrote on last edited by
        #3

        the entry point is the start address of the dll. and any way i tried as you told me but it did'nt work too it says unable to find Sum. marcoryos

        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