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. calling code with MFC in non MFC environment

calling code with MFC in non MFC environment

Scheduled Pinned Locked Moved C / C++ / MFC
helpc++comjsonworkspace
5 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.
  • A Offline
    A Offline
    act_x
    wrote on last edited by
    #1

    I am developing a COM based exe that needs some already available functionality ( which exists in the form a static library using MFC ( MFC statically linked ) ). The API's exposed by the static library use primitive data types such as int , unsigned char etc . However when I include the static library in the COM project, it gives me a linker error about some CString's used . This is how the code is organized static library header file mystatic.h int LibFunc1( int in, char *out) ; static library source file mystatic.cpp int LibFunc1( int in, char *out) { .. CString s = "Hello"; } Com Component using static library #include "mystatic.h" .. .. LibFunc1(x, y) I am wondering if there is a better way of re-using this as I dont want to rewrite the static library logic . Help is appreciated.

    Engineering is the effort !

    M 1 Reply Last reply
    0
    • A act_x

      I am developing a COM based exe that needs some already available functionality ( which exists in the form a static library using MFC ( MFC statically linked ) ). The API's exposed by the static library use primitive data types such as int , unsigned char etc . However when I include the static library in the COM project, it gives me a linker error about some CString's used . This is how the code is organized static library header file mystatic.h int LibFunc1( int in, char *out) ; static library source file mystatic.cpp int LibFunc1( int in, char *out) { .. CString s = "Hello"; } Com Component using static library #include "mystatic.h" .. .. LibFunc1(x, y) I am wondering if there is a better way of re-using this as I dont want to rewrite the static library logic . Help is appreciated.

      Engineering is the effort !

      M Offline
      M Offline
      Mark Salsbery
      wrote on last edited by
      #2

      What version of MFC is the library linked with? If CString is the only class you use, it's no longer part of MFC, and can be used without MFC. Mark

      Mark Salsbery Microsoft MVP - Visual C++ :java:

      A 2 Replies Last reply
      0
      • M Mark Salsbery

        What version of MFC is the library linked with? If CString is the only class you use, it's no longer part of MFC, and can be used without MFC. Mark

        Mark Salsbery Microsoft MVP - Visual C++ :java:

        A Offline
        A Offline
        act_x
        wrote on last edited by
        #3

        MFC 4

        Engineering is the effort !

        1 Reply Last reply
        0
        • M Mark Salsbery

          What version of MFC is the library linked with? If CString is the only class you use, it's no longer part of MFC, and can be used without MFC. Mark

          Mark Salsbery Microsoft MVP - Visual C++ :java:

          A Offline
          A Offline
          act_x
          wrote on last edited by
          #4

          I have stated CString as an eg however the static library uses other classes such as CStringArray , CArray etc

          Engineering is the effort !

          M 1 Reply Last reply
          0
          • A act_x

            I have stated CString as an eg however the static library uses other classes such as CStringArray , CArray etc

            Engineering is the effort !

            M Offline
            M Offline
            Mark Salsbery
            wrote on last edited by
            #5

            Cool. What are the exact linker errors? From the code you've shown, the COM module shouldn't know anything about a CString in the library code. Mark

            Mark Salsbery Microsoft MVP - Visual C++ :java:

            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