dll entry point not found

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?Sm9hY2hpbQ==?=

    #1

    dll entry point not found

    I'm trying to call my C++/CLI dll from a C# library. I gives me the error

    unable to find an entry point named GetA

    Here's my C++/CLI file:

    #pragma once

    //#ifdef WRAPPERAPI_EXPO RTS
    //#define WRAPPER_API extern "C" __declspec(dlle xport)
    //#else
    //#define WRAPPER_API extern "C" __declspec(dlli mport)
    //#endif

    #include "windows.h"
    #include "Common.h"

    namespace Wrapper
    {
    int GetA();
    int GetB();
    void Preinitialize() ;
    }

    As you can see I have also tried with a module definition file, but it
    didn't work (perhaps it is not supposed to work with C++/CLI libraries?).

    In dependency walker there seem to be no functions listed. I'm not sure if
    it should show with a C++/CLI module...?

    I know I had this project working before... :(
  • SvenC

    #2
    Re: dll entry point not found

    Hi Joachim,

    Joachim wrote:
    I'm trying to call my C++/CLI dll from a C# library. I gives me the
    error unable to find an entry point named GetA
    >
    Here's my C++/CLI file:
    >
    #pragma once
    >
    //#ifdef WRAPPERAPI_EXPO RTS
    //#define WRAPPER_API extern "C" __declspec(dlle xport)
    //#else
    //#define WRAPPER_API extern "C" __declspec(dlli mport)
    //#endif
    >
    #include "windows.h"
    #include "Common.h"
    >
    namespace Wrapper
    {
    int GetA();
    int GetB();
    void Preinitialize() ;
    }
    I am not sure if a namespace mangles the names? I woudl expect that it does.
    So move the exported functions into the global namespace and use your
    WRAPPER_API define:

    WRAPPER_API int GetA();
    WRAPPER_API int GetB();
    As you can see I have also tried with a module definition file, but it
    didn't work (perhaps it is not supposed to work with C++/CLI
    libraries?).
    You still need a def file to avoid name mangling
    In dependency walker there seem to be no functions listed. I'm not
    sure if it should show with a C++/CLI module...?
    Please recheck in Depends after you changed the above.

    --
    SvenC

    Comment

    • =?Utf-8?B?Sm9zaCBDaGFuZw==?=

      #3
      Re: dll entry point not found

      Hi SvenC,

      There is a bug in VS2005 (VC8), some dll entry point couldn't be
      found....
      I dont know if this is exacly the problem of yours...but it worth a try.....

      [Solution of workaround]
      Open the project of your VC++ dll,

      Project | XXX Properties ->
      Configuration Properties -General -Use of MFC
      Change from "Use Standard Windows Libraries" to "Use MFC in a Static
      Library"
      and then rebuild the project for the first time, this will add some
      missing components into your dll.......

      finally swith back to "Use Standard Windows Libraries" and rebuild for
      the 2nd time.....you ll have the final workable .dll........
      Try it......hope this is helpful




      "SvenC" wrote:
      Hi Joachim,
      >
      Joachim wrote:
      I'm trying to call my C++/CLI dll from a C# library. I gives me the
      error unable to find an entry point named GetA

      Here's my C++/CLI file:

      #pragma once

      //#ifdef WRAPPERAPI_EXPO RTS
      //#define WRAPPER_API extern "C" __declspec(dlle xport)
      //#else
      //#define WRAPPER_API extern "C" __declspec(dlli mport)
      //#endif

      #include "windows.h"
      #include "Common.h"

      namespace Wrapper
      {
      int GetA();
      int GetB();
      void Preinitialize() ;
      }
      >
      I am not sure if a namespace mangles the names? I woudl expect that it does.
      So move the exported functions into the global namespace and use your
      WRAPPER_API define:
      >
      WRAPPER_API int GetA();
      WRAPPER_API int GetB();
      >
      As you can see I have also tried with a module definition file, but it
      didn't work (perhaps it is not supposed to work with C++/CLI
      libraries?).
      >
      You still need a def file to avoid name mangling
      >
      In dependency walker there seem to be no functions listed. I'm not
      sure if it should show with a C++/CLI module...?
      >
      Please recheck in Depends after you changed the above.
      >
      --
      SvenC
      >

      Comment

      • Ben Voigt

        #4
        Re: dll entry point not found


        "SvenC" <SvenC@communit y.nospamwrote in message
        news:D3BBCA52-BF99-478A-9CD9-ABF2D1B0AFF4@mi crosoft.com...
        Hi Joachim,
        >
        Joachim wrote:
        >I'm trying to call my C++/CLI dll from a C# library. I gives me the
        >error unable to find an entry point named GetA
        >>
        >Here's my C++/CLI file:
        >>
        >#pragma once
        >>
        >//#ifdef WRAPPERAPI_EXPO RTS
        >//#define WRAPPER_API extern "C" __declspec(dlle xport)
        >//#else
        >//#define WRAPPER_API extern "C" __declspec(dlli mport)
        >//#endif
        >>
        >#include "windows.h"
        >#include "Common.h"
        >>
        >namespace Wrapper
        >{
        >int GetA();
        >int GetB();
        >void Preinitialize() ;
        >}
        >
        I am not sure if a namespace mangles the names? I woudl expect that it
        does.
        It does for C++ names, but not for extern "C" identifiers.
        So move the exported functions into the global namespace and use your
        WRAPPER_API define:
        >
        WRAPPER_API int GetA();
        WRAPPER_API int GetB();
        >
        >As you can see I have also tried with a module definition file, but it
        >didn't work (perhaps it is not supposed to work with C++/CLI
        >libraries?).
        >
        You still need a def file to avoid name mangling
        >
        >In dependency walker there seem to be no functions listed. I'm not
        >sure if it should show with a C++/CLI module...?
        >
        Please recheck in Depends after you changed the above.
        >
        --
        SvenC

        Comment

        Working...