class library
-
hi.. I hve design .net based C++ class library. I want to use it in vb.net proj. My class library code compile without an error. But when i access that library in vb.net proj it gives me an error (its run time error) error discription: Unhandled Exception: System.BadImageFormatException: Could not load file or asse mbly 'Appa, Version=1.0.2598.12775, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect fo rmat. File name: 'Appa, Version=1.0.2598.12775, Culture=neutral, PublicKeyToken=null' at Anna.MyModule.Main() WRN: Assembly binding logging is turned OFF. To enable assembly bind failure logging, set the registry value [HKLM\Software\M icrosoft\Fusion!EnableLog] (DWORD) to 1. Note: There is some performance penalty associated with assembly bind failure lo gging. To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fus ion!EnableLog]. =========================================================== // Appa.h #pragma once using namespace System; namespace Appa { public ref class MyClass { public: int Add(int x, int y); }; } =========================================================== // This is the main DLL file. #include "stdafx.h" #include "Appa.h" namespace Appa { int MyClass :: Add(int x, int y) { int k = x+y; return k; } } ================================================= //MyModule.vb Module MyModule Sub Main() Dim obj As New Appa.MyClass Console.WriteLine(obj.Add(10, 15)) End Sub End Module ================================================= plz help me guys
-
hi.. I hve design .net based C++ class library. I want to use it in vb.net proj. My class library code compile without an error. But when i access that library in vb.net proj it gives me an error (its run time error) error discription: Unhandled Exception: System.BadImageFormatException: Could not load file or asse mbly 'Appa, Version=1.0.2598.12775, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect fo rmat. File name: 'Appa, Version=1.0.2598.12775, Culture=neutral, PublicKeyToken=null' at Anna.MyModule.Main() WRN: Assembly binding logging is turned OFF. To enable assembly bind failure logging, set the registry value [HKLM\Software\M icrosoft\Fusion!EnableLog] (DWORD) to 1. Note: There is some performance penalty associated with assembly bind failure lo gging. To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fus ion!EnableLog]. =========================================================== // Appa.h #pragma once using namespace System; namespace Appa { public ref class MyClass { public: int Add(int x, int y); }; } =========================================================== // This is the main DLL file. #include "stdafx.h" #include "Appa.h" namespace Appa { int MyClass :: Add(int x, int y) { int k = x+y; return k; } } ================================================= //MyModule.vb Module MyModule Sub Main() Dim obj As New Appa.MyClass Console.WriteLine(obj.Add(10, 15)) End Sub End Module ================================================= plz help me guys
Where is your DllMain function ? And how did you create your dll project ?
Cédric Moonen Software developer
Charting control [v1.1] -
Where is your DllMain function ? And how did you create your dll project ?
Cédric Moonen Software developer
Charting control [v1.1]// This is the main DLL file. #include "stdafx.h" #include "Appa.h" namespace Appa { int MyClass :: Add(int x, int y) { int k = x+y; return k; } } and abt dll in vs2005 just select new project visual c++ CLR --> class library in this way... and i also add referece of this proj in vb.net proj. MyClass is my classs and add is my main dll fuction
-
// This is the main DLL file. #include "stdafx.h" #include "Appa.h" namespace Appa { int MyClass :: Add(int x, int y) { int k = x+y; return k; } } and abt dll in vs2005 just select new project visual c++ CLR --> class library in this way... and i also add referece of this proj in vb.net proj. MyClass is my classs and add is my main dll fuction
dalbhide bipin wrote:
CLR --> class library
Isn't CLR managed C++ (I know nothing about managed C++ so I'm not sure). If yes, you'd better ask this forum[^]
Cédric Moonen Software developer
Charting control [v1.1]