469,282 Members | 1,704 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,282 developers. It's quick & easy.

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_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... :(
May 11 '07 #1
3 9275
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_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();
}
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

May 11 '07 #2
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_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();
}

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
May 20 '07 #3

"SvenC" <Sv***@community.nospamwrote in message
news:D3**********************************@microsof t.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_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();
}

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

May 22 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Mike in Santa Rosa | last post: by
reply views Thread by allan_mclellan | last post: by
reply views Thread by =?Utf-8?B?R2Vvcmdl?= | last post: by
2 posts views Thread by FFrozTT | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.