Click to See Complete Forum and Search --> : DLL Questions
kasracer
August 10th, 2003, 09:09 PM
1. Does anyone have any projects they could upload of a very very simple DLL project? Like maybe with just 1 simple function or something? I'm just trying to see how exactly it's done in VC .NET
2. I wrote some VB code for a DLL I WAS working on with VB, however, it uses mostly .NET functions so I was wondering how difficult would it be to transfer it to C++
3. If I make a C++ DLL with managed and un-managed code, will it be faster than if I did it all in VB with managed code?
MooNull
August 11th, 2003, 12:35 AM
1. It's really easy to make a DLL in VC.net. Just make an "Empty Project.net" and go into the Project Properties dialog [right click on the project under the solution]. In the project properties, on the first page you will see, change the part that says "Application (.exe)" to "Dynamic Link Library (.dll). Next, go into the Linker folder and find the subfolder that has something like this "$OutputDir/$OutputFile.exe". Change the .exe part in this to .dll. Add some source code and build. You have a dll.
2. VB --> C++ = relatively easy, though dependent on if you are doing crazily complicated things, of course.
3. Good question.
Do reply if you have a question about using the .dll in another project.
kasracer
August 11th, 2003, 12:56 AM
Originally posted by MooNull
1. It's really easy to make a DLL in VC.net. Just make an "Empty Project.net" and go into the Project Properties dialog [right click on the project under the solution]. In the project properties, on the first page you will see, change the part that says "Application (.exe)" to "Dynamic Link Library (.dll). Next, go into the Linker folder and find the subfolder that has something like this "$OutputDir/$OutputFile.exe". Change the .exe part in this to .dll. Add some source code and build. You have a dll.
2. VB --> C++ = relatively easy, though dependent on if you are doing crazily complicated things, of course.
3. Good question.
Do reply if you have a question about using the .dll in another project.
I know how to use a DLL in another project, I just assume you reference it and then use it?
I tried exactly what you say, but I'm not sure as to what kind of course code to add to create a C++ DLL since I've only used VB source code to make 1.
I was working on a couple of things just to play around, I have 1 header file with 3 templates in it and wanted to see if I could build that into a DLL, but it does not so I assume you need to use .cpp files to do so...
kasracer
August 11th, 2003, 01:15 AM
I figured it out and I compiled a DLL, I'm not quite sure how to use it in my VB .NET project though, so far it's only unmanaged code within the DLL
MooNull
August 11th, 2003, 01:54 PM
I'm guessing the .dll is written in unmanaged C++...
This has got me thinking though... Both VB.net [managed VB] and C++.net [managed C++] compile into the same thing, MSIL [microsoft intermediate language]. There might be a way to interface the the code without having to rewrite either one...
Just a thought...
If you get around to it, try referencing one .exe of a project within another. Since it will be in MSIL and not binary, you might be able to use it similar to a .dll. Of course, I could be utterly wrong :D
kasracer
August 11th, 2003, 03:53 PM
Originally posted by MooNull
I'm guessing the .dll is written in unmanaged C++...
This has got me thinking though... Both VB.net [managed VB] and C++.net [managed C++] compile into the same thing, MSIL [microsoft intermediate language]. There might be a way to interface the the code without having to rewrite either one...
Just a thought...
If you get around to it, try referencing one .exe of a project within another. Since it will be in MSIL and not binary, you might be able to use it similar to a .dll. Of course, I could be utterly wrong :D na
I put both into 1 solutions., referenced the DLL to the VB project but can't figureout how to run the functions within my DLL.
I have 3 simple functions in it.
MooNull
August 11th, 2003, 07:05 PM
I'm guessing you've made sure you are using the namespace they are in and tried standard VB function calling...?
kasracer
August 11th, 2003, 07:12 PM
Originally posted by MooNull
I'm guessing you've made sure you are using the namespace they are in and tried standard VB function calling...? Yes....
This is my first DLL in C++ and it compiles file, but when referenced to my VB project, I can't access any of the functions within it... maybe I'm not doing something wrong?
Also, I get 2 wierd errors.
1 was something .NET didn't like in the boost library but it was only a warning and said it would only affect performance, because a bool value was being forced to true or false or something like that.
The other was it was *****ing about the command /cls(I think that's the right command, something like that) and said using that to compile may result in an importly working DLL with /IMAGE or something like that but was just a warning.
codeguru.com
Copyright WebMediaBrands Inc., All Rights Reserved.