|
-
April 2nd, 2006, 11:18 AM
#1
Please Help - Importing and using a DLL?
Hi,
I have no idea on where to even get started here.
Basically I have a DLL written in C#, I want to be able to use that in my VC++ 2005 project.
How can I do this?
I'm guessing #import "<name>/dll", which compiles, but then how can I use the class contained within?
Thanks
Regards,
Big Winston
-
April 2nd, 2006, 01:04 PM
#2
Re: Please Help - Importing and using a DLL?
What kind of DLL is it? COM?
-
April 3rd, 2006, 02:20 PM
#3
Re: Please Help - Importing and using a DLL?
Well, I have the c# source project. I have set it up to build a COM dll.
It seemed to work fine. Now I am trying to use it in my project.
It compiles fine (using functionality from the DLL no problem). Then when I run I get the following error:
Code:
An unhandled exception of type 'System.IO.FileNotFoundException' occurred in AutoInspectorX+.exe
Additional information: Could not load file or assembly '<dllname>, Version=1.2.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
So I read around a bit and it seems I have to do some registration of the dll (it's my first time doing this ! ).
So I tried : regsrv32 <dllname>.dll
I then get the following error :
Code:
<dllname>.dll was loaded but the DllRegisterServer entry point was not found.
The file can not be registered.
And now I'm stuck!
Please help
Regards,
Big Winston
-
April 3rd, 2006, 02:28 PM
#4
Re: Please Help - Importing and using a DLL?
It sounds like it's not really a COM DLL. Does your DLL have the 'DllRegisterServer' exported?
Viggy
-
April 3rd, 2006, 02:47 PM
#5
Re: Please Help - Importing and using a DLL?
Not sure. How do I find that out?
Regards,
Big Winston
-
April 3rd, 2006, 02:50 PM
#6
Re: Please Help - Importing and using a DLL?
The function should be in the source code for the DLL. Along with a function called 'DllUnregisterServer' (or something like that).
All COM DLL's have these funcitons. They're used to register (and unregister) the COM object. THey also allow you to do some customization during initializing.
Viggy
-
April 3rd, 2006, 02:55 PM
#7
Re: Please Help - Importing and using a DLL?
A find in all files of the source showed nothing like you say.
What can I do to use this?
Can I convert to a COM dll or use it as a "normal" dll?
Regards,
Big Winston
-
April 3rd, 2006, 03:12 PM
#8
Re: Please Help - Importing and using a DLL?
I just re-read your initial post, and the DLL is written in C#? I'm not sure how to work with that, as I've never used C#. Perhaps someone else will have a suggestion...
Sorry!
Viggy
-
April 3rd, 2006, 10:12 PM
#9
Re: Please Help - Importing and using a DLL?
At first,check your c# dll can work on COM.
Next,You must output tlb file from your c# dll by excuting regasm.exe command(you can find it in .NET Framework's SDK).
Finally,import the yourdll.tlb in your c++ project .
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
|