Click to See Complete Forum and Search --> : [RESOLVED] Dll and its location


Saeed
September 30th, 2008, 08:36 PM
I have created a C# dll and call that dll in my VC++

In my VC++ i simplly have included

#import "C:\Mydot-net-projects\sManagedDLL\sManagedDLL\bin\Debug\sManagedDLL.tlb"
...
...
I run this to register my dll and create the tlb file
>RegAsm.exe smanageddll.dll /tlb:smanageddll.tlb /codebase


HRESULT hr = CoInitialize(NULL);
ICalculatorPtr pICalc(__uuidof(ManagedClass));

....
char_t *p=static_cast<wchar_t *>(pICalc->Get(szTemp1,szTemp2)); // call the Dll





Now The problem is that my VC++ caller expects the Dll to be found at a fixed location on C drive
which is
C:\Mydot-net-projects\sManagedDLL\sManagedDLL\obj\Debug .
That is becuase once the dll is deleted from that folder the Vc++ crashes when its attempting to call the dll

Whatsetting do I need to change on my C# project to make sure the VC++.EXE caller can find the dll where the .EXE is residing rather than
C:\Mydot-net-projects\sManagedDLL\sManagedDLL\obj\Debug becuase once the dll

Saeed
September 30th, 2008, 10:26 PM
I can actually run this on my PC where the tbl points to my dll where it was created.
Once the EXE goes into another machine because that folder s not there with the DLL in it it wont work.