Sign in to follow this  
wyanh

OpenGL How to create a dll for an opengl window?

Recommended Posts

I have wrote an application with an openGL window, for some reason, I need to change it completely to a dll, how to begin my program?

Share this post


Link to post
Share on other sites
Wow. You've given us exactly enough information to... Ask for more information!

Why do you need a dll? The only reason I can think of is that you are trying to hook into another process' WndProc, and that begs further questions.

Share this post


Link to post
Share on other sites
Quote:
Original post by wyanh
[...] for some reason, [...]

I guess if he tells us he will have to kill us.

So, wyanh, I'm assuming that you are using C++.

The header should look like this:

#ifndef __MAIN_H__
#define __MAIN_H__

//add normal includes here, like
#include <windows.h>

/* To use this exported function of dll, include this header
* in your project.
*/


#ifdef BUILD_DLL
#define DLL_EXPORT __declspec(dllexport)
#else
#define DLL_EXPORT __declspec(dllimport)
#endif


#ifdef __cplusplus
extern "C"
{
#endif

int DLL_EXPORT SomeFunction (it's parameters);

#ifdef __cplusplus
}
#endif

#endif // __MAIN_H__


and the cpp file:

#include "that header.h"

int DLL_EXPORT SomeFunction (it's parameters)
{
//implementation
}



Then in the compile settings you should find what you are compiling, like in MSVC you go to project's properties and under "General" there is a field named "Configuration Type" where you can select a dll.

Share this post


Link to post
Share on other sites
I use mfc build the opengl window, my team need to put the window into the C# window forme, like a ActiveX, just give the ActiveX several parametres. but the Activex program I built before build failed on the leader's window7 system, (I build it on windows xp system),so,the leader ask me do a dll,with the functions same to an ActiveX.

Share this post


Link to post
Share on other sites
You should probably ask on the general programming questions since your question is about how to make a dll. Of course, the best thing to do is to search on the internet and then if you are having problems, ask a more specific question.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this