|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today! |
|
#1
|
|||
|
|||
|
Passing Variables betwen DLLs
Final problem:
I have two DLL's. One is controls Business logic and is called Enterprise_BUS and the other is called Enterprise_DAL. The _BUS would normally contain business logic but for the time being it simply passes the variables from to the _DAL. So I have this: PHP Code:
However I get a Ambiguous name detected error when compiling. If I change the name of the functions I will violate the task conditions. So my question is two-fold: Is the way I've declared it correct (I've been using the terse examples from the MSDN as a template) and how do I make the Ambiguous name error disappear? I have a feeling the answer might solve both problems at once. Thanks again, Graham Reeds |
|
#2
|
|||
|
|||
|
Quote:
This part is pretty easy. In your code you have used the same name for more than one variable, object, or procedure.
__________________
====== Doug G ====== I didn't attend the funeral, but I sent a nice letter saying I approved of it. --Mark Twain |
|
#3
|
|||
|
|||
|
But the procedures are in different DLL's, and the spec says they have to stay the same.
Are you sure there is no other way around it? |
|
#4
|
|||
|
|||
|
I have got slightly further. I modified the declarations like so:
Code:
Private Declare Function FindByName_DAL Lib "Enterprise_DAL.dll" Alias "FindByName" (EmployeeName As String) As ADODB.Recordset and the function like this: Code:
' Find By Employee Public Function FindByName(EmployeeName As String) As ADODB.Recordset Dim RS As ADODB.Recordset Set RS = FindByName_DAL(EmployeeName) Set FindByName = RS End Function But when I run the program I get the error "Can't find DLL entry point FindByName in Enterprise_DAL.dll" However, if I change the line in the ASP to use the Enterprise_DAL class instead of Enterprise_BUS it works fine. I seem to solve one error to slam straight into another. |
|
#5
|
|||
|
|||
|
You can't just arbitrarily rename a function declaration from a dll, it must match the dll.
You should rename your vb code FindByName function to something else to eliminate the duplication of the function name. |
|
#6
|
|||
|
|||
|
The way I understand it, in the declaration the Alias allows VB to call functions that they wouldn't normally be able to call i.e: functions that begin with an underscore. In C++ terms it would be like having a pointer to a function.
So what my declaration does (or how I planned it to work) would be to say "There's a function in Enterprise_DAL.dll which is called FindByName. To differentiate it from the FindByName in this DLL we will call it FindByName_DAL". Take this example from the MSDN (http://msdn.microsoft.com/library/d...llprocedure.asp): Declare Function InvertRect Lib "user32" Alias "InvertRectA" (ByVal hdc As Long, lpRect As RECT) As Long The actual windows function is InvertRectA but the programmer just types MyLong = InvertRect(MyHDC, myRect). The errormessage suggests that my assumption of how it works is correct: "Can't find DLL entry point FindByName in Enterprise_DAL.dll". It's looking for the FindByName function. Just that it can't find it. I also tried removing the .DLL extension from the declaration and copying the DLL's to the same directory as the asp (they were previously in separate directories) and that failed to work also. Thanks, Graham Reeds. P.S.: I would of replied sooner, but I installed SP6 for VB thinking it might help, but it killed IIS stone dead, and spent the last few hours fixing that, and then the permissions in SQL Server 2000. |
|
#7
|
|||
|
|||
|
Why don't you just leave the dll function name alone, and rename your VB code function?
|
|
#8
|
|||
|
|||
|
Quote:
According to the specs I was asked to follow I am not allowed. The functions in the _BUS are just to pass the variables along to the corresponding functions in the _DAL dll. I've handed it in incomplete - I had overrun the time allowed anyway. But then again two weeks ago I had never touched IIS, SQL Server 2000, VB or ASP (I'm a C++ & Oracle man myself) so I think I have done okay. I do appreciate your help though. Thanks |
![]() |
| Viewing: ASP Free Forums > Programming > Visual Basic Programming > Passing Variables betwen DLLs |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|