Unable to find an entry point named 'Add' in DLL 'CPPDLL.dll'. while running a c#.net web application


I have created a small web application using c#.net that calls a function from a dll file created in c++

the following are the files that i have used to create a dll file..

//CPPDLL.cpp file

#include “stdafx.h”

#include “CPPDLL.h”

using namespace std;

namespace CPPDLL
double Class1::Add(double a, double b)
return a + b;

//CPPDLL.h file

#pragma once

using namespace System;

namespace CPPDLL {

public class Class1
// TODO: Add your methods for this class here.
static __declspec(dllexport) double Add(double a, double b);


Now my c#.net code is as follows

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using CPPDLL;
using System.Runtime.InteropServices;

public partial class _Default : System.Web.UI.Page

[DllImport("CPPDLL.dll", EntryPoint="Add")]

private static extern double Add(double a, double b);

protected void Page_Load(object sender, EventArgs e)

protected void Button1_Click(object sender, EventArgs e)
double sum = Add(12, 13);

After running the application when i press the button the following error is displayed…..

Unable to find an entry point named ‘Add’ in DLL ‘CPPDLL.dll’.

help me please in finding the problem…

Keerthi raj
9/16/2008 4:43:50 AM
asp.net.getting-started 91979 articles. 4 followers. Follow

3 Replies

Similar Articles

[PageSpeed] 22


Looked at your code, the only thing as of now i can point you to is the signature of the Add method.  The signature of the add method in the CPPDLL is double Class1::Add(double a, double b), by not specifying the access modifier i believe it is public by default in c++ and its is private in c#. and in your c# code you have private static extern double Add(double a, double b);. This gives me a feeling of signature mismatch. Try removing the private access modifier in your c# and see what happens and let us know.




9/16/2008 8:43:59 AM

 the same error is occuring...even after changing the access modifier

Keerthi raj
9/16/2008 1:36:32 PM


 you most to declare the follow code:


Native DLL C/C++:

Sample DLL "CPPDLL.dll"

in the ".h"

extern "C" __declspec(dllimport) double Add(double x, double y);

 in the ".c" or ".cpp"

__declspec(dllimport) double Add(double x, double y)


       return (x*y);



From C# Component:

 public class ImplementNativeDll


     [DllImport(@"CPPDLL.dll", EntryPoint="Add")]

     public extern static double Add( double x, double y);


public class ExecuteCode


        public static void Main()


                 double xy = ImplementNativeDll.Add( 6.0, 5.0 );

                  System.Console.WriteLine("Result: {0}", xy);






Developer Senior





10/30/2008 5:45:24 PM

Similar Artilces:

Name: haznen Email: haznenatyahoodotcom Product: Gran Paradiso Alpha 8 Summary: '''''''''''''''''''' Comments: '''''''''''''''''''''''''''''''''''' Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/20061204 UGES/ GranParadiso/3.0a1 From URL: http://www.mozilla.org/projects/granparadiso/ Note to readers: Hendrix gives...

Problem: The type 'typename' exists in both 'dll-name-1' and 'dll-name-2'
Hi at all!For some strange reason I sometimes (not always) get the following compilation error when starting my ASP.net project:Server Error in '/' Application. Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. Compiler Error Message: CS0433: The type 'ASP.formscontrols_worker_it_ascx' exists in both 'c:\WINDOWS\Microsoft.NET\Framework\v2.0....

Name: mario Email: ramar17atfastwebnetdotit Product: Gran Paradiso Alpha 2 Summary: ''''' Comments: K: Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a2) Gecko/20070206 GranParadiso/3.0a2 ...

Error 1 The type 'System.Web.UI.WebControls.LinqDataSource' exists in both 'c:\WINDOWS\assembly\GAC_MSIL\System.Web.Extensions\\System.Web.Extensions.dll' and 'c:\WINDOWS\asse
Once I build project. I encounter this error. Does someone experience this error?Error    1    The type 'System.Web.UI.WebControls.LinqDataSource' exists in both 'c:\WINDOWS\assembly\GAC_MSIL\System.Web.Extensions\\System.Web.Extensions.dll' and 'c:\WINDOWS\assembly\GAC_MSIL\System.Web.Extensions\\System.Web.Extensions.dll'    D:\Source Code\Linq_Lesson5\Default.aspx    1    1    D:\Source Code\Linq_Lesson5\  It appears tha...

INSTALL 'freetyp6.dll' and 'fntcfg2.dll' i
Where can I download these as non yum/rum versions? TIA -- Regards Dave Saville On 03/10/15 11:08 AM, Dave Saville wrote: > Where can I download these as non yum/rum versions? > > TIA > http://rpm.netlabs.org/release/00/zip/ contains all the zip files that have been packaged as zip files. Don't forget about libpng-1_6_16-1_oc00.zip, urpo.dll which needs to be the latest and may have not been packaged and possibly z, bzip, and xv libraries, I haven't tried the newest but Bitwise seems to want to have as many dependencies as possible. Dave ps GCC1.d...

Error 43 The type 'Controls_XX' exists in both '..\App_Web_blah1.dll' and '..\App_Web_blah2.dll'
When I try to publish my website I keep getting these errors which relate to various conflicts present in subdirectories at c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\ The problem always relates to a particulate User Control : 'Controls_PgHeader', which is just about the only control which is modified from one compilation to the next. Other than manually deleting the files which are in conflict, what is the solution and source of this problem? Here is a sample error message: Error 43 The type 'Controls_PgHeader' exists in bot...

Occaisonal Build problems (type 'xxx' exists in both 'yyy.dll' and 'xxx.dll')?
Hello: Been working with Express for about 2 months now -- and it generally works fine -- but I occaisonally get this error message when I rebuild projects to rerun it: ------ Rebuild All started: Project: http://localhost/TestIV/, Configuration: Debug .NET ------ Build Web Beginning D:\DEV\DEV_NET\CS\SITES\TestIV\portal.aspx(9,31): error CS0433: The type 'ASP.Portal' exists in both 'c:\WINDOWS\Microsoft.NET\Framework\v2.0.40607\Temporary ASP.NET Files\testiv\2bc5e680\fdf16dd9\f3iai7un.dll' and 'c:\WINDOWS\Microsoft.NET\Framework\v2.0.40607\Temporary ASP.NET Files\testiv\...

'do' won't 'do' if '/'
Greetings to All from Au, Have a NetWare Perl 5.8.4 and wanted to tweak File\Spec\NW.pm to try and standardise on '/' separators. If I run a test script (t/uni/lower.t) with an unmodified NW.pm, it calls t/uni/case.pl, that, in case.pl, (when the path separators are '\'), the $file is '..\lib\unicore\To\Lower.pl' and the following code portion works, with $simple getting a returned table: sub casetest { my ($base, $spec, $func) = @_; my $file = File::Spec->catfile(File::Spec->catdir(File::Spec->updir, "lib", &qu...

odd error: 'RdleaseSemaphore' in DLL 'kernel32.dll'.
I have a windows 2003 Standard sp2 32bit server running ASP.NET 1.1/2.0/3.0/3.5 9with service packs, etc running that whenever attempting to use any connection to MSSQL throws the following error:  Exception Details: System.EntryPointNotFoundException: Unable to find an entry point named 'RdleaseSemaphore' in DLL 'kernel32.dll'.     I have tried simple apps, to complex apps, and they errors are the same. Google is unable to find anything on this matter which is rare. Has ANYONE ever seen this, and if not what could cause it?   i can provide the...

ISAPI 'C:\Windows\Microsoft.net\Framework\v.1.1.4322\aspnet_isapi.dll' reported itself as unhealthy for the following reason: 'Deadlock detected'.
In our web application we are calling different XML Webservices and make approximately 25 calls every 10 minutes. We use a separate thread to call a the webservice (Crawler) and populate our cache -- our application then retrieves the data from the Cache -- the cache is set to expire in approximately 25 minutes -- but since the Crawler populates the cache every 10 minutes with the new data -- thus it never expires. In above scenario -- our webserver seems to stop responding after some hours and we noticed that somehow requests to Webservices were ...

Name: L Lachowsky Email: e2brutus_10atyahoodotcom Product: Firefox Summary: ''' Comments: why duddn this surprise me... I change default server from IE to Mozilla, and then i get error messages. well, shud I decide to not get on my computer with Mozilla..or shud I risk security breeches with IE....hmmm at least i can get on the internet with IE Browser Details: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv: Gecko/2008120122 Firefox/3.0.5 From URL: http://hendrix.mozilla.org/ Note to readers: Hendrix gives no expectation of a response to this fee...

Cast from type ''''DBNull'''' to type ''''String'''' is not valid.
How do I avoid getting this error: Cast from type ''''DBNull'''' to type ''''String'''' is not valid. I am trying to get values from the database into a form for updating using a Datareader, SQL is set to allow nulls for certain fields as they are not required but the only way I can get the form to display is by adding a space in SQL. Is there another way around this? Check if it is equal to DBNull.Value first and if it is, don't do the cast.Stanley Tan theSpoke Blog Where in the code does it need to go? I am using the following and it's the profile that isn't always requi...

LINQ -- how to do where x in ('a', 'b','c')
How do I write a LINQ expression that does the following: select * from SomeTable where SomeColumn in ('a', 'b','c')  Jay There is no IN operator in LINQ (yet), but you can use Contains instead: http://www.devauthority.com/blogs/jwooley/archive/2007/08/06/69922.aspx Jos...

The type '<class>' exists in both '<dll location>' and '<dll location 2>'
Hi. Has anyone come across this problem upgrading VS2003 to VS2005:The type '<class>' exists in both '<dll location>' and '<dll location 2>' Thanks! Hi TinaFMills,   Did you finish the process of migrate project form 2003 to 2005?   The error message means duplicate class name in different locations. Such as aspx pages, user controls, custom controls and so on. Please load the solution in Visual Studio IDE try to find the duplicate class. Edit->File and Replace->Find In Files (look in entire solution)    Sincerely,Benson YuMicrosoft Online...

Web resources about - Unable to find an entry point named 'Add' in DLL 'CPPDLL.dll'. while running a c#.net web application - asp.net.getting-started

resources last updated: 11/20/2015 7:54:15 PM