Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. class library

class library

Scheduled Pinned Locked Moved Visual Basic
helpcsharpc++wpf
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    dalbhide bipin
    wrote on last edited by
    #1

    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

    D 1 Reply Last reply
    0
    • D dalbhide bipin

      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

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      You'd be better off asking this in the C++ forum. My C++ is pretty rusty, but this doesn't look like a COM componet you've written, or a .NET assembly. You're trying to use a C++ style class in managed code, and that just isn't going to work. It needs to be rewritten using CLI (Managed C++) in order to be used the way your doing it now. But, like I said, you're in the wrong forum for an accurate answer to this question.

      Dave Kreskowiak Microsoft MVP - Visual Basic

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups