DLL compiling (GL2PS)

This is a discussion on DLL compiling (GL2PS) within the Windows Programming forums, part of the Platform Specific Boards category; Hello, I have found a library that I want to include in my program. I am a Pascal programmer and ...

  1. #1
    Registered User
    Join Date
    Aug 2010
    Posts
    8

    (Solved) DLL compiling (GL2PS)

    Hello,

    I have found a library that I want to include in my program. I am a Pascal programmer and the library in written in C. It is GL2PS, to convert OpenGL drawings into images (EPS, PDF, SVG, ....).

    I am not familiar with C programming but would like to have the library. The library can be compiled to a windows dll as stated on the website. I have asked if they have the library (.dll) available, but it is not. No one has reacted to my question if I could download it anywhere and I can't seem to find it anywhere on the internet.

    I have downloaded Visual Studio 2010 Express to see if I could compile it myself. But it gives me all kind of errors and I am not able to fix them. So I was wondering if anyone out here might be able to compile the file for me so I could use it in my program.

    Thanks in advance, you'll make me very happy (since I am trying to get the dll for over 2 weeks now already and still no luck).
    Last edited by Whatever3; 08-04-2010 at 04:01 PM. Reason: Solved

  2. #2
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,789
    Can you post some of the errors?

  3. #3
    Registered User
    Join Date
    Aug 2010
    Posts
    8
    1>------ Build started: Project: GL2PS, Configuration: Debug Win32 ------
    1> gl2ps.c
    1>gl2ps.c(3406): error C2065: 'M_PI' : undeclared identifier
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

  4. #4
    Registered User
    Join Date
    Aug 2010
    Posts
    8
    Fixed the M_PI with:
    #ifndef M_PI
    #define M_PI 3.14159265358979323846
    #endif

    Now I get:

    1>gl2ps.c(3410): warning C4244: '=' : conversion from 'double' to 'GLfloat', possible loss of data
    1>gl2ps.obj : error LNK2019: unresolved external symbol __imp__glGetIntegerv@8 referenced in function _gl2psPrintPostScriptBeginViewport
    1>gl2ps.obj : error LNK2019: unresolved external symbol __imp__glGetFloatv@8 referenced in function _gl2psPrintPostScriptBeginViewport
    1>gl2ps.obj : error LNK2019: unresolved external symbol __imp__glRenderMode@4 referenced in function _gl2psPrintPostScriptBeginViewport
    1>gl2ps.obj : error LNK2019: unresolved external symbol __imp__glFeedbackBuffer@12 referenced in function _gl2psBeginPage
    1>gl2ps.obj : error LNK2019: unresolved external symbol __imp__glIsEnabled@4 referenced in function _gl2psBeginPage
    1>gl2ps.obj : error LNK2019: unresolved external symbol __imp__glPassThrough@4 referenced in function _gl2psAddText
    1>gl2ps.obj : error LNK2019: unresolved external symbol __imp__glGetBooleanv@8 referenced in function _gl2psAddText
    1>gl2ps.obj : error LNK2019: unresolved external symbol __imp__glEnd@0 referenced in function _gl2psDrawImageMap
    1>gl2ps.obj : error LNK2019: unresolved external symbol __imp__glVertex3f@12 referenced in function _gl2psDrawImageMap
    1>gl2ps.obj : error LNK2019: unresolved external symbol __imp__glBegin@4 referenced in function _gl2psDrawImageMap
    1>C:\Users\Jarry\Desktop\gl2ps\gl2ps-1.3.5-source\Debug\GL2PS.dll : fatal error LNK1120: 10 unresolved externals

    that seem like external files?

  5. #5
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,789
    Try open the gl2ps.h and paste this towards the top:

    Code:
    #ifndef M_PI
    #define M_PI           3.14159265358979323846
    #endif
    #pragma comment(lib, "OpenGL32.Lib")
    #pragma warning(disable:4244)
    #pragma warning(disable:4267)
    The first part adds the definition of M_PI. Then you need to add the library for opengl (that's what the #pragma comment does). I added a few lines to suppress warnings for size mismatches - if it were my code I'd get to the bottom of it, but you should be ok in this instance

  6. #6
    Registered User
    Join Date
    Aug 2010
    Posts
    8
    Wow it worked with your pragma code! Thanks man! You don't know how happy I am right now, whereas it seemed to be not that hard as I suspected. Thanks!

  7. #7
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,789
    No probs.

  8. #8
    Registered User
    Join Date
    Aug 2010
    Posts
    8
    Reopening. I have the dll but when I run DLL Export Viewer (DLL Export Viewer - view exported functions list in Windows DLL) over it, it does not give me the functions that I would expect from the .h file.

    Any ideas what could be the reason for this?

  9. #9
    Registered User
    Join Date
    Aug 2010
    Posts
    8
    I have added:

    # define GL2PSDLL_API
    # define GL2PSDLL_API __declspec(dllexport)

    and now it seems to work

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Losing reference between dlls
    By g4j31a5 in forum Windows Programming
    Replies: 7
    Last Post: 05-19-2010, 03:28 AM
  2. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 03:39 PM
  3. dll communicating between each other
    By cloudy in forum C++ Programming
    Replies: 5
    Last Post: 06-17-2005, 03:20 AM
  4. DLL compiling question
    By Noose in forum Windows Programming
    Replies: 2
    Last Post: 12-16-2004, 07:16 AM
  5. DLL and std::string woes!
    By Magos in forum C++ Programming
    Replies: 7
    Last Post: 09-08-2004, 01:34 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21