Hi Guys,
I am trying to use a C++ dll in VB.NET code.
I have imported the dll in the following manner:
<code>
Imports System.Runtime.InteropServices
Module modDllImport
<DllImport("hsec.dll")> _
Public Function sha1_hash(ByRef co As String, ByRef ci As String) As
Integer
End Function
<DllImport("aes.dll")> _
Public Function aes_enc(ByRef co As String, ByRef ci As String) As Integer
End Function
End Module
</code>
However when I call the exported method, I get the following error:
Unable to find an entry point named sha1_hash in DLL hsec.dll.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.
Exception Details: System.EntryPointNotFoundException: Unable to find an
entry point named sha1_hash in DLL hsec.dll.
I am not sure where I am going wrong. The dlls are in my system32 folder as
well. I hope that .NET works with normal C/C++ dlls as well along with COM
dlls.
Any kind of help would be really appreciated.
Thanks,
Regards,
-Prashant 6 17908
another victim of name mangling i suppose ;-)
c++ compiler will mangle names, when compiling the c++ the dll generate a
map file and look at the real names (in case you have the dll's source
surround the declarations with extern "C" blocks to stop the mangling)
you can also use the dumpbin tool to look at the actual exported function
names in the dll
HTH
Rahul r_*****@nospam.yahoo.com
"Prashant Bhuptani" <pb*******@itstrategists.com> wrote in message
news:ef**************@TK2MSFTNGP09.phx.gbl... Hi Guys,
I am trying to use a C++ dll in VB.NET code.
I have imported the dll in the following manner:
<code>
Imports System.Runtime.InteropServices
Module modDllImport <DllImport("hsec.dll")> _ Public Function sha1_hash(ByRef co As String, ByRef ci As String) As Integer End Function
<DllImport("aes.dll")> _ Public Function aes_enc(ByRef co As String, ByRef ci As String) As
Integer End Function End Module
</code>
However when I call the exported method, I get the following error:
Unable to find an entry point named sha1_hash in DLL hsec.dll. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.EntryPointNotFoundException: Unable to find an entry point named sha1_hash in DLL hsec.dll.
I am not sure where I am going wrong. The dlls are in my system32 folder
as well. I hope that .NET works with normal C/C++ dlls as well along with COM dlls.
Any kind of help would be really appreciated.
Thanks,
Regards, -Prashant
* "Prashant Bhuptani" <pb*******@itstrategists.com> scripsit: I am trying to use a C++ dll in VB.NET code.
I have imported the dll in the following manner:
<code>
Imports System.Runtime.InteropServices
Module modDllImport <DllImport("hsec.dll")> _ Public Function sha1_hash(ByRef co As String, ByRef ci As String) As Integer End Function
<DllImport("aes.dll")> _ Public Function aes_enc(ByRef co As String, ByRef ci As String) As Integer End Function End Module
</code>
However when I call the exported method, I get the following error:
Unable to find an entry point named sha1_hash in DLL hsec.dll. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.EntryPointNotFoundException: Unable to find an entry point named sha1_hash in DLL hsec.dll.
Can you post the "heads" of the C functions and the exports of the C
DLL?
--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>
<http://www.plig.net/nnq/nquote.html>
On 2003-11-06, Rahul Kapoor <sp**@nospam.com> wrote: another victim of name mangling i suppose ;-)
c++ compiler will mangle names, when compiling the c++ the dll generate a map file and look at the real names (in case you have the dll's source surround the declarations with extern "C" blocks to stop the mangling)
Not if your using __stdcall. The best way to do it is to create a .def
file.
--
Tom Shelton
MVP [Visual Basic]
Hi Herfried,
I have a test code in VC++ which calls the exported methods of these dlls.
These methods are declared in the header file as follows:
__declspec(dllexport) int sha1_hash(const unsigned char ci[],unsigned char
co[]);
__declspec(dllexport) int aes_enc(const unsigned char ci[],char co[]);
However, I don't have the code which is used to create the dll.
So as of now I am not sure how the .def file is created, but if that helps
in solving this problem, I can definitely find out.
Thanks,
Regards,
-Prashant
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:bo*************@ID-208219.news.uni-berlin.de... * "Prashant Bhuptani" <pb*******@itstrategists.com> scripsit: I am trying to use a C++ dll in VB.NET code.
I have imported the dll in the following manner:
<code>
Imports System.Runtime.InteropServices
Module modDllImport <DllImport("hsec.dll")> _ Public Function sha1_hash(ByRef co As String, ByRef ci As String) As Integer End Function
<DllImport("aes.dll")> _ Public Function aes_enc(ByRef co As String, ByRef ci As String) As
Integer End Function End Module
</code>
However when I call the exported method, I get the following error:
Unable to find an entry point named sha1_hash in DLL hsec.dll. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.EntryPointNotFoundException: Unable to find an entry point named sha1_hash in DLL hsec.dll.
Can you post the "heads" of the C functions and the exports of the C DLL?
-- Herfried K. Wagner MVP · VB Classic, VB.NET <http://www.mvps.org/dotnet>
<http://www.plig.net/nnq/nquote.html>
In article <u9*************@tk2msftngp13.phx.gbl>, Prashant Bhuptani wrote: Hi Herfried,
I have a test code in VC++ which calls the exported methods of these dlls. These methods are declared in the header file as follows:
__declspec(dllexport) int sha1_hash(const unsigned char ci[],unsigned char co[]); __declspec(dllexport) int aes_enc(const unsigned char ci[],char co[]);
However, I don't have the code which is used to create the dll. So as of now I am not sure how the .def file is created, but if that helps in solving this problem, I can definitely find out.
Thanks,
Regards, -Prashant
do a dumpbin /exports on the dll to see the exported names of the
functions. More then likely, they are not sha1_enc and aes_enc. There
is generally type information appended to the names (I don't remember
the exact characters any more). The point is, if there is no .DEF file
for the functions, the names actually get changed by the compiler. To
use them from VB.NET, you will need to specify that name...
Delcare Function sha1_hash Lib "...." Alias "exported name from dumpbin"
(....) As ....
--
Tom Shelton
MVP [Visual Basic]
Thanks a lot Tom and everyone else for your help.
So after doing a dumpin /exports on the dll I used the exported function
names and declared it in my VB code.
And hence it works now. So there was definitely no .DEF file used for the
functions.
Thanks again.
regards,
-Prashant
"Tom Shelton" <to*@mtogden.com> wrote in message
news:u$**************@TK2MSFTNGP10.phx.gbl... In article <u9*************@tk2msftngp13.phx.gbl>, Prashant Bhuptani
wrote: Hi Herfried,
I have a test code in VC++ which calls the exported methods of these
dlls. These methods are declared in the header file as follows:
__declspec(dllexport) int sha1_hash(const unsigned char ci[],unsigned
char co[]); __declspec(dllexport) int aes_enc(const unsigned char ci[],char co[]);
However, I don't have the code which is used to create the dll. So as of now I am not sure how the .def file is created, but if that
helps in solving this problem, I can definitely find out.
Thanks,
Regards, -Prashant
do a dumpbin /exports on the dll to see the exported names of the functions. More then likely, they are not sha1_enc and aes_enc. There is generally type information appended to the names (I don't remember the exact characters any more). The point is, if there is no .DEF file for the functions, the names actually get changed by the compiler. To use them from VB.NET, you will need to specify that name...
Delcare Function sha1_hash Lib "...." Alias "exported name from dumpbin"
(....) As ....
-- Tom Shelton MVP [Visual Basic] This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Randy Crockett |
last post by:
I have created a very simple DLL in VC++ 6.0, then created a very simple App in VC++ 6.0 to use the DLL and this works fine
When I try to use the same DLL in C#, with DLLImport, the app finds the...
|
by: aneesh |
last post by:
Hi all,
I would like to know whether we can specify another function instead
of main as entry point.
Thanks
Aneesh
|
by: Sam Fields |
last post by:
I have found very little regarding the error "Unable to find an entry point
named EnumerateSecurityPackagesW in DLL security.dll. ". I have an ASP.NET
Web Service being accessed via SSL. I found...
|
by: TRI_CODER |
last post by:
I am trying to solve the following exception. The exception occurs when my
ASP.NET code behind code attemtps to access a remore site using SSL. Please
note that all certificates are valid and the...
|
by: Pratibha |
last post by:
hi,
i made a dll named rtbdts.dll and call it from vb.net through dllimport
<DllImport("C:\misc\rtbdll\rtbdts.dll")>
Public Shared Function Init() As String
End Function
But it returns the...
|
by: Saman |
last post by:
I have a third party dll and I am sure that it is not an activeX or dotnet
assembly .
I have check it up with Dependency Walker software and found the list of
it's exported function in C++ syntax...
|
by: raam_kimi |
last post by:
Hi All
I got some problem in importing advapi32.dll when i call the LogonUser method it throws an error like this
'Unable to find an entry point named LogonUser in DLL advapi32.dll.'
...
|
by: =?Utf-8?B?SnVhbiBEZW50?= |
last post by:
Hi,
I am getting the following in a VC++ EXE (using VS2005) that links several
C++ DLLs and uses MFC and ATL, when I try to start it under the debugger:
-------
'Exactus.UX.Studio.v1.exe':...
|
by: souporpower |
last post by:
Hello All
I am trying to activate a link using Jquery. Here is my code;
<html>
<head>
<script type="text/javascript" src="../../resources/js/
jquery-1.2.6.js"</script>
<script...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |