CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2000

    Accessing a windows DLL with interop

    Hello Folks
    I'm trying to access a regular windows 32 dll ( not a COM dll ) through .NET interop and I'm getting an exception EntryPointNotFoundException.

    DLL was created using VS6. Following is the DLL code.

    #include "stdafx.h"

    BOOL APIENTRY DllMain( HANDLE hModule,
    DWORD ul_reason_for_call,
    LPVOID lpReserved
    return TRUE;

    _declspec(dllexport) int Jumbo(int x)
    return 11;

    Following is the .NET code (VS2008)

    using System.Runtime.InteropServices ;

    public partial class Form1 : Form
    public static extern int Jumbo(int x) ;

    public Form1()

    private void cmdClick_Click(object sender, EventArgs e)
    int y = Jumbo(1); ///This call throws exception



    Now I tested the DLL with dll walker and I can see the exports. Also
    I made another application using VC++ 6, and called the function in the DLL

    Could anyone tell me what is it I'm doing wrong?


  2. #2
    Join Date
    Jun 2008

    Re: Accessing a windows DLL with interop

    This was asked literally 4 days ago and is on the second page of this forum:


  3. #3
    Join Date
    Aug 2000

    Re: Accessing a windows DLL with interop

    thank you BigEd. It gave me a clue. I need to declare the function

    extern "C" _declspec(dllexport) int Jumbo(int x)

    and it does the trick.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.