[RESOLVED] Entry point in Dynamic Link Library (DLL) ?
Hey there people,
I'm creating a project with an Add-on system, and I'm releasing an API so people can develop for my application (its called Levanta, its a basic Sub-OS, and i want people to be able to develop for it). There's just ONE problem...
I try to call a sample DLL i made to test out the system i created. Well, i CANT, because its not finding the functions entry point of the said function (its named initialize)...?:eek:
MSDN does a very crappy job of providing help on this topic:mad:, and its not clearly stated on exactly how to do it. I know what an entry point IS, i just don't know how to make one. Any help would be great (help here or a link to an external source would be fine)
Hoping somebody has the answer!:confused:,
Matt
---------
You kno, just if your knew to a forum, doesn't make you a noob at programming.... I'm 15 and been doing this for 3 years (did vb6 too).
Re: Entry point in Dynamic Link Library (DLL) ?
Re: Entry point in Dynamic Link Library (DLL) ?
Your post is rather incoherent, but I think I get the idea. The reason that you can't find the information you want is not because the documentation is crappy. It's because the documentation doesn't exist, because what you want to do is not possible. When you create a .NET DLL you are creating an assembly, i.e. a .NET executable whose types are accessed either at design time by referencing the assembly or at run time by loading the assembly dynamically and using Reflection.
The term "entry point" is used for functions directly exported from unmanaged libraries, i.e. DLLs that are not .NET and not COM. Such libraries, e.g. those that comprise the Windows API, expose functions directly and you can call them in .NET apps via proxy methods decorated with the DllImport attribute. You do NOT create such DLLs in VB.NET.
If you want to create an extensible app then you should consider the following options:
1. The traditional way to create an app that supports plug-ins is to define an IPlugin interface in a separate DLL that you reference in your app and plug-in developers reference in their DLL. At run time, you search a folder and load assemblies dynamically, using Reflection to find types that implement your IPlugin interface.
2. Use the System.AddIn namespace. I can't provide details as I've done some basic reading but never actually used it myself.
3. Use the Managed Extensibility Framework. Again, I've never used it and haven't even really done much reading on the subject. It's relatively new and I haven't had cause to use it so far.
Re: Entry point in Dynamic Link Library (DLL) ?
I'm trying to access code from a dll WITHOUT having to import it to the project basically... i try to declare the function from the dll i'm using doing this:
Code:
Declare Function Init Lib "C:\Levanta_Calculator.dll"() as System.Windows.Forms.Form
The function in the Dynamic Link Library called In Init looks like this:
Code:
Public Function Init() As System.Windows.Forms.Form
Return Me
End Function
And i add a Form_Load handler in the Add-On program that runs this:
Code:
Sub Form1_Load() Handles MyBase.Load
Dim FormLoader = Init()
FormLoader.MdiParent = Me
FormLoader.Show()
End Sub
I try to perform this function, and all i get is an error that goes like this:
Quote:
EntryPointNotFound Exception was Unhandled : Unable to find an entry point named 'Init' in DLL 'C:\Levanta_Calculator.dll'.
Get it now?
Re: Entry point in Dynamic Link Library (DLL) ?
@jmcilhinney, OK. I'll take a look into those options. That helps a lot! Well, how would i go about an Entry Point in C#? Is it possible there? C++?
Re: Entry point in Dynamic Link Library (DLL) ?
Quote:
Originally Posted by
matt_wendel
Well, how would i go about an Entry Point in C#? Is it possible there?
C# is a .NET language, just like VB.NET. Read my previous post and you'll have your answer.
Quote:
Originally Posted by
matt_wendel
C++?
It's not possible in C++/CLR but it is possible in unmanaged C++. What's the point though? If the DLLs are specifically going to be consumed by a .NET application then why would you want to create an unmanaged interface? You're just making things harder for no gain.
Re: Entry point in Dynamic Link Library (DLL) ?