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. C / C++ / MFC
  4. class library

class library

Scheduled Pinned Locked Moved C / C++ / MFC
helpcsharpc++wpf
4 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

    C 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

      C Offline
      C Offline
      Cedric Moonen
      wrote on last edited by
      #2

      Where is your DllMain function ? And how did you create your dll project ?


      Cédric Moonen Software developer
      Charting control [v1.1]

      D 1 Reply Last reply
      0
      • C Cedric Moonen

        Where is your DllMain function ? And how did you create your dll project ?


        Cédric Moonen Software developer
        Charting control [v1.1]

        D Offline
        D Offline
        dalbhide bipin
        wrote on last edited by
        #3

        // 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

        C 1 Reply Last reply
        0
        • D dalbhide bipin

          // 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

          C Offline
          C Offline
          Cedric Moonen
          wrote on last edited by
          #4

          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]

          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