FUNCSTRUCT FUNC to header without symbol already defined error

Hello everyone.

So i have in .h:
1
2
3
4
5
6
#pragma once
#ifndef FRAMEWORK_OPENGL_H_INCLUDED
#define FRAMEWORK_OPENGL_H_INCLUDED
extern "C" __declspec(dllexport) inline bool init_opengl();
PFNGLCREATESHADERPROC glCreateShader
#endif 


and in .cpp
1
2
3
4
5
extern "C" __declspec(dllexport) bool init_opengl()
{
	glCreateShader = (PFNGLCREATESHADERPROC)glGetProcAddressREGAL("glCreateShader");
	return 1;
}


the question is how i do thing that i can use glCreateShader func in header without getting symbol already define error?

one thing what i would do is:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
PFNGLCREATESHADERPROC _glCreateShader;
extern "C" __declspec(dllexport) bool init_opengl()
{
	_glCreateShader = (PFNGLCREATESHADERPROC)glGetProcAddressREGAL("glCreateShader");
	return 1;
}

unsigned int glCreateShader( unsigned int type )
{
    return _glCreateShader(type);
}

// and to header then:
inline unsigned int glCreateShader( unsigned int type );


but there have to be a better way.
Thanks everyone!

.h:line 5: Prepend the declaration with keyword extern.
Topic archived. No new replies allowed.