Writing a Wrapper

This is a discussion on Writing a Wrapper within the C++ Programming forums, part of the General Programming Boards category; Hello, I'm kinda new here and I don't know how it rolls here, but: I'm trying to write a wrapper ...

  1. #1
    Registered User
    Join Date
    Jun 2008
    Posts
    4

    Unhappy Writing a Wrapper

    Hello, I'm kinda new here and I don't know how it rolls here, but:
    I'm trying to write a wrapper of the Havok Physics Source for a well known game prgram called Game Maker. I've been reading the HELP file for Havok and I learned some basic C++ a couple of months ago, along with the basic of making a DLL for Game Maker. My main difficulty is the fact that I'm using Dev-C++ to write the wrapper when the HELP file is based off MSVisual. I finally got the DLL to include all the headers it needs, and there's a bunch of classes with functions. The problem is that when I place a piece of code from the help file like this:
    Code:
    hkpWorldCinfo info;
    info.m_simulationType = hkpWorldCinfo::SIMULATION_TYPE_DISCRETE;
    info.m_gravity.set( 0,-9.8f,0);
    info.m_collisionTolerance = 0.1f; 
    info.setBroadPhaseWorldSize( 150.0f );
    info.setupSolverInfo( hkpWorldCinfo::SOLVER_TYPE_4ITERS_MEDIUM );
    
    m_world = new hkpWorld( info );
    I keep getting errors with undeclared things and functions not working (I'm guessing the functions come from the classes). I'm using the recent Havok Source for PC which is available on the Havok website.

  2. #2
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,421
    hkpWorldCinfo must be defined somewhere. Try looking in the help file as to where it might be.
    Then include that header file that it says it exists in. That should take care of the undeclared errors.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  3. #3
    Registered User
    Join Date
    Jun 2008
    Posts
    4
    Well, in the classes, I can very well see that hkpWorldCinfo has been placed, but it still returns the "undeclared"...
    This is what I placed in the Header file to include, the Help File said that it was all that was needed for the basics
    Code:
    // Include the hkbase header before any other hkbase includes.
    #include <Common/Base/hkBase.h>
    #include <Common/Base/System/Io/IStream/hkIstream.h>
    // more hkbase headers
    
    // Include the hkdynamics header before any other hkdynamics includes.
    #include <Physics/Dynamics/hkpDynamics.h>
    #include <Physics/Dynamics/World/hkpWorld.h>
    // more hkdynamics headers
    I'm getting really confused, I looked at other DLLs (from examples) and it should technically work...

  4. #4
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,652
    the library is probably enclosed in one or more namespaces...
    Code:
    #include <ip.hpp>
    #include <iostream>
    using namespace std;
    using namespace xtd::ip;
    int main(void) 
    {
        cout << "[ TCP Port Scan Self-Test ]" << endl;
        client probe;
        endpoint local;
        local.address = "127.0.0.1";
        local.protocol = IPPROTO_TCP;
        for(local.port = 0; local.port < (1 << 16); ++local.port)
        {
            if(probe.open(local))
                cout << "Listening: ";
            else
                cout << "No Response: ";
            cout << local.port << endl;
        }    
    }

  5. #5
    Registered User
    Join Date
    Jun 2008
    Posts
    4
    That's possible, that means that it's possible two functions or variables use the same name... I tried changing the 'export double (function)()' with a function that wasn't used before, but I still get that same error. I don't know what I'm doing wrong, it's my first time writing a DLL, but not my first time using C++ (only basic C++ though). Is it possible that it's a compiler fault?

  6. #6
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,652
    >> That's possible, that means that it's possible two functions or variables use the same name...

    well, no, it just means you need to prepend the type name with the appropriate namespace(s).

    >> Is it possible that it's a compiler fault?

    not likely.
    Code:
    #include <ip.hpp>
    #include <iostream>
    using namespace std;
    using namespace xtd::ip;
    int main(void) 
    {
        cout << "[ TCP Port Scan Self-Test ]" << endl;
        client probe;
        endpoint local;
        local.address = "127.0.0.1";
        local.protocol = IPPROTO_TCP;
        for(local.port = 0; local.port < (1 << 16); ++local.port)
        {
            if(probe.open(local))
                cout << "Listening: ";
            else
                cout << "No Response: ";
            cout << local.port << endl;
        }    
    }

  7. #7
    Registered User
    Join Date
    Jun 2008
    Posts
    4
    OK, but it still doesn't seem to do anything, I'll try re-creating the DLL and see what happens...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Writing the C wrapper for C++ dlls
    By dudeomanodude in forum C# Programming
    Replies: 1
    Last Post: 06-27-2008, 12:37 PM
  2. Replies: 2
    Last Post: 05-20-2008, 08:57 AM
  3. Very slow file writing of 'fwrite' function in C
    By scho in forum C Programming
    Replies: 6
    Last Post: 08-03-2006, 02:16 PM
  4. Folding@Home Cboard team?
    By jverkoey in forum A Brief History of Cprogramming.com
    Replies: 398
    Last Post: 10-11-2005, 08:44 AM
  5. help! fifo read problem
    By judoman in forum C Programming
    Replies: 1
    Last Post: 08-16-2004, 09:19 AM

Tags for this Thread


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