| | |
Problem in loading VC++ Win32 dll in C#
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Oct 2006
Posts: 38
Reputation:
Solved Threads: 0
Hi sir,
I am making a win32 dll in VC++.NET 2005. I make an add funtion in it and then i call it from C# using System.Runtime.InteropServices;
[DllImport("MXFWrapperMarvel.dll", EntryPoint = "add")]
static extern int add(int a, int b);
My code is compiled successfully, no errors and warnings. But when calling the add() function then, a runtime exception is raising while calling add() fuction...
"Unable to load DLL 'MXFWrapperMarvel.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)"
The dll is also placed on the right path but still raising exception. If I remove the above header files from dll code then my code also compiled successfully as well as add() function is also functioning correctly. But after just including those header files in dll code, it is compiled successfully but raised the above exception at runtime while calling add() function and my code jumps to the catch block .
Please guide me how can I resolve this problem.
--
Regards,
Asif
I am making a win32 dll in VC++.NET 2005. I make an add funtion in it and then i call it from C# using System.Runtime.InteropServices;
[DllImport("MXFWrapperMarvel.dll", EntryPoint = "add")]
static extern int add(int a, int b);
C++ Syntax (Toggle Plain Text)
----------------------MXFWrapperMarvel.dll------------without header files--------------- #include "stdafx.h" #include <AtlConv.h> #ifdef _MANAGED #pragma managed(push, off) #endif extern "C" __declspec(dllexport) int APIENTRY add(int a, int b) { return a+b; } BOOL APIENTRY DllMain( HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) { return TRUE; } #ifdef _MANAGED #pragma managed(pop) #endif ------------------------------------------------------------------------------------------------- this add function working correctly. But I want to include some header files of third party SDK. ---------------------MXFWrapperMarvel.dll-------------with header files------------------- #include "stdafx.h" #include <AtlConv.h> #include "MOG/MXFComponents/EssenceAnalyzer/MPEG/EssenceTypes.h" #include "MOG/MXFComponents/EssenceAnalyzer/AES3/EssenceTypes.h" #include "MOG/MXFComponents/EssenceAnalyzer/BWave/EssenceTypes.h" #include "MOG/MXFComponents/EssenceAnalyzer/AES3/S302M/EssenceTypes.h" #ifdef _MANAGED #pragma managed(push, off) #endif extern "C" __declspec(dllexport) int APIENTRY add(int a, int b) { return a+b; } BOOL APIENTRY DllMain( HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) { return TRUE; } #ifdef _MANAGED #pragma managed(pop) #endif --------------------------------------------------------------------------------------------------
"Unable to load DLL 'MXFWrapperMarvel.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)"
The dll is also placed on the right path but still raising exception. If I remove the above header files from dll code then my code also compiled successfully as well as add() function is also functioning correctly. But after just including those header files in dll code, it is compiled successfully but raised the above exception at runtime while calling add() function and my code jumps to the catch block .
Please guide me how can I resolve this problem.
--
Regards,
Asif
c++ Syntax (Toggle Plain Text)
//...maybe this impl. can help [DllImport("./MXFWrapperMarvel.dll", EntryPoint = "add")] static extern int APIENTRY add(int a, int b); //...
![]() |
Similar Threads
- PLEASE HELP - Infected with 'New WIN32' virus, and cannot log in to my laptop. (Viruses, Spyware and other Nasties)
- IE, MSN, and anything related to IE freezes on start up (Viruses, Spyware and other Nasties)
- Not-A-Virus.Monitor.Win32.Ardamax.ae (Viruses, Spyware and other Nasties)
- POS.tmp file and red X problem (Viruses, Spyware and other Nasties)
- Computer was infected- Need a second set of eyes? (Viruses, Spyware and other Nasties)
- Explorer.exe continuously restarts right after boot-up! (Viruses, Spyware and other Nasties)
- Backdoor.Win32.Loony.m (Viruses, Spyware and other Nasties)
- Recent problem: Slowdown, viruses of some sort, and many other things. (Viruses, Spyware and other Nasties)
- HijackThis and AVG-antispyware logs (Viruses, Spyware and other Nasties)
- Generic Host Process for Win32 Services Error / DCOM networking error -- please help! (Windows NT / 2000 / XP)
Other Threads in the C++ Forum
- Previous Thread: Having trouble with a else... else if loop (For a class)
- Next Thread: A problem with classes
| Thread Tools | Search this Thread |
api array based beginner binary bitmap c++ c/c++ calculator char char* class code coding compile compiler console conversion count database delete deploy desktop developer directshow dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game givemetehcodez google graph gui homeworkhelp homeworkhelper iamthwee ifstream input int java lib linkedlist linker list loop looping loops map math memory multiple news node number numbertoword output parameter pointer problem program programming project python random read recursion recursive reference rpg sorting string strings temperature template templates test text text-file tree unix url variable vector video visualstudio win32 windows winsock word wordfrequency wxwidgets





