joshturner1967
Fri Oct 10 14:34:44 CDT 2008
On Oct 9, 6:45=A0pm, "Igor Tandetnik" <itandet...@mvps.org> wrote:
> joshturner1967 <joshturner1...@gmail.com> wrote:
> > I guess I got confussed with the fact that I had to use the tlb
> > instead to of the dll. =A0Like I said in non .Net versions I could use
> > the dll.
>
> You are still #importing a TLB, it's just embedded into that DLL as a
> resource. You could do that with a .NET DLL too, if you are so inclined:
>
>
http://msdn.microsoft.com/en-us/library/ww9a897z.aspx
>
> --
> With best wishes,
> =A0 =A0 Igor Tandetnik
>
> With sufficient thrust, pigs fly just fine. However, this is not
> necessarily a good idea. It is hard to be sure where they are going to
> land, and it could be dangerous sitting under them as they fly
> overhead. -- RFC 1925
Thanks again Igor
I do have one more question that has arisen from this process. I am
running into another issue now that I have created a c++ dll that is
unmanaged that calls the VB.net 2005 dll that is managed.
You see our legacy system is wrttten in in C and C++ within VS 2003
and what we do is make a call to LoadLibrary in one of the the 'C'
modules that looks similar to this
HMODULE hRetVal;
char *dllpath
hRetVal =3D LoadLibrary(dllpath);
The dll path is built internally but resovles to c:\myfile\Debug
\VBCallFromC.dll - the location of the c++ dll that is used to call
the VB.Net 2005 dll for the calendar. We do this so that we can use
smart pointers down the road within the 'C' programs
Anyway previously we have been able to do this with code that was
wrtten in VB6. I would suspect that maybe the problem is that the VB6
program was not a managed program and niether is the code that calls
it. However since the new VB.Net 2005 dll is written as managed and
the other code is not then I think that is my problem because I get
the following error message\crash when I try and run the hRetVal =3D
LoadLibrary(dllpath); line of code
DLL 'c:\myfile\Debug\VBCallFromC.dll' is attempting managed
execution inside OS Loader lock. Do not attempt to run managed
code inside a
DllMain or image initialization function since doing so can
cause the
application to hang.
From my research (
http://msdn.microsoft.com/en-us/library/
aa290048.aspx#vcconmixeddllloadingproblemanchor6) it appears that
LoadLibary might not work properly or need work arounds in order to
work since the article claims LoadLibaray is specifically identified
as being unsafe inside a DllMain function under most circumstances
I have tried the using the \noentry switch in my properties\command
line \addtional properties section of my VBCallFromC.dll project -
This did not do anything
Do you know what I can do to get around this line of code? I am very
close to my proof of concept and just have this last hurdle to get
over.
Any suggestions would be appreciated
Thanks
Josh