I have checked a few related answers here and in other web sources… and I think I am doing this correctly… but obviously not. I seem to be missing something, probably obvious… Here are the pertinent code snippets: The .dll code… Option Explicit On Option Compare Text Public Class AlertsGlobals Dim stack() As String, pntr As Integer = -1 Public Const DLL_PROCESS_DETACH = 0 Public Const DLL_PROCESS_ATTACH = 1 Public Const DLL_THREAD_ATTACH = 2 Public Const DLL_THREAD_DETACH = 3 Public Function DllMain(ByVal hInst As Long, _ ByVal fdwReason As Long, _ ByVal lpvReserved As Long) As Boolean Select Case fdwReason Case DLL_PROCESS_DETACH ’ No per-process cleanup needed Case DLL_PROCESS_ATTACH DllMain = True Case DLL_THREAD_ATTACH ’ No per-thread initialization needed Case DLL_THREAD_DETACH ’ No per-thread cleanup needed End Select End Function Public Function AlertsGlobalPushLine(ByVal inString As String) As Boolean . . End Function Public Function AlertsGlobalPopLine(ByRef outString) As Boolean . . End Function End Class ================================================================== Snippet of calling program: Public Class Form1 Dim … Declare Function AlertsGlobalPopLine Lib “C:Documents and Settings…AlertsSupport.dll” (ByRef lineIn As String) As Boolean Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load . . globalRtn = AlertsGlobalPopLine(lineIn) ← error on this line . . End Sub Any help appreciated, Gordo

Can I suggest you download the free version of .Net Reflector from .NET Decompiler: Decompile Any .NET Code | .NET Reflector? The tool will give you not only the calling sequences but it will also show you the actual code (vb or c#) of each routine within the DLL or EXE, assuming it’s not obfuscated. I use this tool all the time with 3rd party software and it’s extremely useful when you’re trying to understand why something is not working. I own the Pro version which even allows one to debug a dll just as if you had the code in your possession, setting breakpoints, checking variables, etc.

Don Bouchard

From: john via visualbasic-l [mailto:visualbasic-l@Groups.ITtoolbox.com]
Sent: Sunday, May 30, 2010 5:55 PM
To: Donald P. Bouchard
Subject: RE: [visualbasic-l] Unable to find an entry point named ‘name’ in DLL ‘library’.

Posted by john
on May 30 at 7:20 PM Mark as helpful

Have you looked at it (the .dll in question) with Object Browser? That will show you the proper calls.

John Warner

From: WinGordo via visualbasic-l [mailto:visualbasic-l@Groups.ITtoolbox.com]
Sent: Sunday, May 30, 2010 4:11 PM
To: john
Subject: RE:[visualbasic-l] Unable to find an entry point named ‘name’ in DLL ‘library’.

Posted by WinGordo
on May 30 at 5:30 PM Mark as helpful

Another day, another attempt, and another failure… but progress.

The .dll code is as shown above in yesterday’s post.

In an attempt to simplify my situation, I made a small VB forms program to act as the “push” side (instead of the C# program described above). It uses AlertsGlobalPushLine(string) to push the contents of a TextBox each time a button is clicked…

The “pop” side remains the same program described above yesterday.

Both programs simply add the library to their respective “references”.

Both programs load and appear to execute successfully… that is, niether reports an error… but it seems clear that each is communicating with a seperate instantiation of the library and not a common single copy desired.

This, I guess, is the cusp of the problem… and, at this point, I have really no idea how to proceed.

All suggestions happily accepted,

Gordo

Have you looked at it (the .dll in question) with Object Browser? That will show you the proper calls.

John Warner

From: WinGordo via visualbasic-l [mailto:visualbasic-l@Groups.ITtoolbox.com]
Sent: Sunday, May 30, 2010 4:11 PM
To: john
Subject: RE:[visualbasic-l] Unable to find an entry point named ‘name’ in DLL ‘library’.

Posted by WinGordo
on May 30 at 5:30 PM Mark as helpful

Another day, another attempt, and another failure… but progress.

The .dll code is as shown above in yesterday’s post.

In an attempt to simplify my situation, I made a small VB forms program to act as the “push” side (instead of the C# program described above). It uses AlertsGlobalPushLine(string) to push the contents of a TextBox each time a button is clicked…

The “pop” side remains the same program described above yesterday.

Both programs simply add the library to their respective “references”.

Both programs load and appear to execute successfully… that is, niether reports an error… but it seems clear that each is communicating with a seperate instantiation of the library and not a common single copy desired.

This, I guess, is the cusp of the problem… and, at this point, I have really no idea how to proceed.

All suggestions happily accepted,

Gordo

Another day, another attempt, and another failure… but progress.

The .dll code is as shown above in yesterday’s post.

In an attempt to simplify my situation, I made a small VB forms program to act as the “push” side (instead of the C# program described above). It uses AlertsGlobalPushLine(string) to push the contents of a TextBox each time a button is clicked…

The “pop” side remains the same program described above yesterday.

Both programs simply add the library to their respective “references”.

Both programs load and appear to execute successfully… that is, niether reports an error… but it seems clear that each is communicating with a seperate instantiation of the library and not a common single copy desired.

This, I guess, is the cusp of the problem… and, at this point, I have really no idea how to proceed.

All suggestions happily accepted,

Gordo

No, it is not registered. And, I have no idea how to do that. Perhaps someone can point me at some instructions…

Also, my continued research has resulted in some progress, and now a somewhat different problem.

Let me explain:

The overall environment is this: the .dll is written in VB (VS2008 express) and is a simple stack manager (push and pop), intended to move data between two programs simultaneously and in real-time. The “pusher” side is a C# (.net) program, and the “popper” side is a VB (same VS) forms program.

Since my original post I have continued looking for a solution and trying different things… the .dll code now looks like this:

Option Explicit On
Option Compare Text
Public Class AlertsGlobals
Public Shared stack() As String, pntr As Integer = -1

Public Shared Function AlertsGlobalPushLine(ByVal inString As String) As Boolean
.
.
.
End Function
Public Shared Function AlertsGlobalPopLine(ByRef outString) As Boolean
.
.
.
End Function
End Class

The “popper” side adds the .dll to its reference list. It compliles, loads, and appears to successfully call the entry point (AlertsGlobalPopLine) which returns “false” because there is nothing to return.

The problem now is on the C# side. I have added the .dll to its reference list. It compiles correctly. However, when it is loaded it issues the error:

… Could not load file or assembly ‘AlertsGlobalsLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null’ or one of its dependencies. The system cannot find the file specified.

I am assuming, because the file is truly there, it is one of the dependancies… Yes? No? or is it because it doeas not have a PublicKey Token?

From an analysis tool, its dependancies appear to be:

Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

and each of these have dependancies, and so on for a couple more levels…

And, I do not know how to specify any of these to the C# side.

Also, because the problem now may be with C# code, is this the wrong venue to discuss… just tell me where it belongs and I will move it.

Again, thanks in advance for any help,

Gordo

Is the DLL registered?

From: WinGordo via visualbasic-l [mailto:visualbasic-l@Groups.ITtoolbox.com]
Sent: Thursday, May 27, 2010 7:12 AM
To: randy_caus
Subject: [visualbasic-l] Unable to find an entry point named ‘name’ in DLL ‘library’.

Posted by WinGordo
on May 27 at 10:10 AM

I have checked a few related answers here and in other web sources… and I think I am doing this correctly… but obviously not. I seem to be missing something, probably obvious…

Here are the pertinent code snippets:

The .dll code…

Option Explicit On
Option Compare Text
Public Class AlertsGlobals
Dim stack() As String, pntr As Integer = -1

Public Const DLL_PROCESS_DETACH = 0
Public Const DLL_PROCESS_ATTACH = 1
Public Const DLL_THREAD_ATTACH = 2
Public Const DLL_THREAD_DETACH = 3

Public Function DllMain(ByVal hInst As Long, _
ByVal fdwReason As Long, _
ByVal lpvReserved As Long) As Boolean
Select Case fdwReason
Case DLL_PROCESS_DETACH
’ No per-process cleanup needed
Case DLL_PROCESS_ATTACH
DllMain = True
Case DLL_THREAD_ATTACH
’ No per-thread initialization needed
Case DLL_THREAD_DETACH
’ No per-thread cleanup needed
End Select
End Function

Public Function AlertsGlobalPushLine(ByVal inString As String) As Boolean
.
.
End Function

Public Function AlertsGlobalPopLine(ByRef outString) As Boolean
.
.
End Function
End Class

Snippet of calling program:

Public Class Form1
Dim …

Declare Function AlertsGlobalPopLine Lib “C:Documents and Settings…AlertsSupport.dll” (ByRef lineIn As String) As Boolean

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
.
.

globalRtn = AlertsGlobalPopLine(lineIn) ← error on this line

.
.
End Sub

Any help appreciated,

Gordo

Gordo,

You need to register your DLL and not specify the exact location of it
in your code:

Declare Function AlertsGlobalPopLine Lib AlertsSupport.dll (ByRef lineIn
As String) As Boolean

HTH
Martin


From: WinGordo via visualbasic-l
[mailto:visualbasic-l@Groups.ITtoolbox.com]
Sent: 27 May 2010 15:12
To: Martin Walke
Subject: [visualbasic-l] Unable to find an entry point named ‘name’ in
DLL ‘library’.

Posted by WinGordo

on May 27 at 10:10 AM
I have checked a few related answers here and in other web sources…
and I think I am doing this correctly… but obviously not. I seem to be
missing something, probably obvious…

Here are the pertinent code snippets:

The .dll code…

Option Explicit On
Option Compare Text
Public Class AlertsGlobals
Dim stack() As String, pntr As Integer = -1

Public Const DLL_PROCESS_DETACH = 0
Public Const DLL_PROCESS_ATTACH = 1
Public Const DLL_THREAD_ATTACH = 2
Public Const DLL_THREAD_DETACH = 3

Public Function DllMain(ByVal hInst As Long, _
ByVal fdwReason As Long, _
ByVal lpvReserved As Long) As Boolean
Select Case fdwReason
Case DLL_PROCESS_DETACH
’ No per-process cleanup needed
Case DLL_PROCESS_ATTACH
DllMain = True
Case DLL_THREAD_ATTACH
’ No per-thread initialization needed
Case DLL_THREAD_DETACH
’ No per-thread cleanup needed
End Select
End Function

Public Function AlertsGlobalPushLine(ByVal inString As String) As
Boolean
.
.
End Function

Public Function AlertsGlobalPopLine(ByRef outString) As Boolean
.
.
End Function
End Class

Snippet of calling program:

Public Class Form1
Dim …

Declare Function AlertsGlobalPopLine Lib “C:Documents and
Settings…AlertsSupport.dll” (ByRef lineIn As String) As Boolean

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
.
.

globalRtn = AlertsGlobalPopLine(lineIn) ← error on this line

.
.
End Sub

Any help appreciated,

Gordo