Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / May 2007

Tip: Looking for answers? Try searching our database.

dll entry point not found

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Joachim - 11 May 2007 14:16 GMT
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_EXPORTS
//#define WRAPPER_API extern "C" __declspec(dllexport)
//#else
//#define WRAPPER_API extern "C" __declspec(dllimport)
//#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 - 11 May 2007 14:38 GMT
Hi Joachim,

> 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
[quoted text clipped - 18 lines]
> 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
Josh Chang - 20 May 2007 02:30 GMT
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
   

> Hi Joachim,
>
[quoted text clipped - 41 lines]
> --
> SvenC
Ben Voigt - 23 May 2007 00:20 GMT
> Hi Joachim,
>
[quoted text clipped - 23 lines]
> 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:
[quoted text clipped - 15 lines]
> --
> SvenC

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.