|
-
Jun 25th, 2001, 01:14 PM
#1
Where have all the DLL's Gone ?
I have just compiled an Active X dll (first time). I have only added a single procedure to the dll and I am passing data in and out of the procedure using types.
I confirmed the code worked at module level in my client program, copied the procedure into an Active X class module along with the type definition info and compiled the code - no problem.
To get at the new external procedure (having deleted the original in my calling code) I used a declare in my calling code that pointed to the dll as "C:\dlldirectory\newdll.dll" - note I had not registered the dll on the system at this time.
This seems to work OK - the file is recognised when I run my calling program - but I get a "Can't find entry point..." message back. What am I doing wrong? Do I need to include some packing procedures that VB needs??
Any help here would be damn usefull in my visualisation of the cosmic all - thanks in advance.
PS - even registering the DLL didn't get around the problem.
-
Jun 25th, 2001, 02:03 PM
#2
Hyperactive Member
When you create an active x dll in vb, you use it differently then you would, say an API function from the user32.dll or kernal32.dll. From what you are saying, I am guessing that you created a dll in vb, and are now trying to use it like the following:
VB Code:
Private Declare My_Function lib "C:\dlldirectory\newdll.dll" (Byval my_procedure as long) as long
VB cannot create standard dll's. Rather, they are created as COM objects. So rather then using the method above, you would do one of the following to use your dll within your projects
1) Go to Project/References in the Menu bar and find your project in the list and select it. This will reference your project (know as early binding) and allow you to use your procedure in the following manor:
VB Code:
Dim myobj as newdll.class1
Private Command1_Click()
Dim lret as long
Set myobj=New newdll.class1
lret = myobj.my_procedure
End sub
2) You can create the object within your project without referencing your control. This process is known as late binding. This would look like the following:
VB Code:
Private Command1_click()
Dim myobj as object
Dim lret as long
Set myobj = CreateObject("newdll.class1")
lret=myobj.my_procedure
end sub
Hope this helps.
-
Jun 25th, 2001, 02:13 PM
#3
Thanks for your well timed input. I had just found the Class in project references and was just rooting through the help file index to see how best to use it and then I noticed the reply you had posted.
Thank you for your crystal clear explanation.
On a background info note - did VB ever allow you to create a simple DLL file? and how portable would the current solution be to say a "C" programmer?
-
Jun 25th, 2001, 03:34 PM
#4
Hyperactive Member
Not that I'm aware of, but I'm a long time C/Assemby programmer, that stated using VB begining with VB 5.
-
Jun 25th, 2001, 03:43 PM
#5
Monday Morning Lunatic
There are tools available for making standard DLLs using VB, but it's mostly a waste of time because VB requires COM for most of its intrinsic functionality 
COM DLLs can be made in C++ (not sure about C) quite easily using ATL, but using the raw COM API (messing around with IUnknown) is painful but makes tiny DLLs
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Jun 26th, 2001, 02:34 AM
#6
Thanks for that reset and parksie.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|