How to work with a .LIB in C++ (IDE:Visual Studio 6)


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 7 of 7

Thread: How to work with a .LIB in C++ (IDE:Visual Studio 6)

  1. #1
    Join Date
    Jul 2005
    Posts
    17

    Exclamation How to work with a .LIB in C++ (IDE:Visual Studio 6)

    Hi all, I'm again here to ask help or informations!
    I have to create a wrapper for a .lib using Visual Studio 6.
    I have to do this cause the source of the lib use templates and Visual Studio 6 isn't able to manage them, and I can't use another IDE.

    Here the questions:
    1) I have the library created in Visual studio 2005, I haven't documentation about it, so what can I do?
    2) How can I create a wrapper in C++ for it using Visual Studio 6? (the most important passes)
    3) If I'll find the source, I have to read/study it to be able to create the wrapper?
    4) In my C++ wrapper, I have to create methods that have the same names of the methods library?
    i.e.:
    in the library I have: GetImages(int x, int y);
    if i want to use this method in my C++ wrapper, have to call: .....->GetImages(x,y);

  2. #2
    Join Date
    Dec 2003
    Posts
    3,366
    -you can use the tools from visual 6 to get the info about the lib -- specifically dumpbin can tell you what is in the file to create a .h file

    -It may be impossible to link a 2005 into a 6.0 due to formatting issues (I dont know!) or even because if 6.0 cannot handle templates you cannot reference the lib properly

    -with the source it will be easier

    - actually I think you can rename them if you use raw hex jump points, but this is harder, do not do it... use the original names.

    all I can say is try it and see. If you have 2005 perhaps make a single function simple lib file and try to call it in 6.0 and see if it is even possible before you go deep down a path that cannot be.

  3. #3
    Join Date
    Jul 2005
    Posts
    17
    It may be impossible to link a 2005 into a 6.0 due to formatting issues (I dont know!) or even because if 6.0 cannot handle templates you cannot reference the lib properly
    I'll try and I'll tell here ;)

  4. #4
    Join Date
    Jul 2005
    Posts
    17
    Sorry again for this question:
    but HOW can I use the library??

    For example I open the project properties and in the "Linking" tab (or where??) I have to add: mylib.lib!
    We assume that in this .lib I have a method called: isFlat();

    What do I have to write in my .cpp file to use that method??

  5. #5
    Join Date
    Dec 2003
    Posts
    3,366
    you add the .lib to the project and the associated .h as well (or # include it or both).
    Then, if it links up, you just call the functions. (thats how in .net, some compilers make this an ordeal)

    you can also do it with a pragma comand or something but that is ugly and hard to find in the code.

  6. #6
    Join Date
    Jul 2005
    Posts
    17
    I asked a wrong question, sorry!!
    I have the source of .lib (now) but Visual Studio 6 can't manage it, because it has some problems to work with some templates.
    I have to create a .h for that .lib, so both will be included in another project and can be used by the users.
    Is it possible? How can I create the .h?
    Last edited by Arkanops; 03-30-2007 at 04:21 AM.

  7. #7
    Join Date
    Dec 2003
    Posts
    3,366
    the same .h that is in the source of the lib should work with the compiled lib file. If visual cannot process this file, I do not know how to tell you to create a working one.

Similar Threads

  1. Visual Studio 2003 on .Net Frame Work 1.1
    By agushary in forum ASP.NET
    Replies: 2
    Last Post: 09-22-2006, 06:57 AM
  2. Identifying Work at Home Scams
    By jacky@ in forum Careers
    Replies: 1
    Last Post: 07-22-2006, 10:39 AM
  3. Replies: 0
    Last Post: 10-15-2001, 08:52 PM
  4. Justification for tele-commuting
    By Jason Langston in forum Careers
    Replies: 10
    Last Post: 08-08-2000, 09:37 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center