User forums > Using Code::Blocks

Trying to create a DLL from Enet source code

<< < (2/4) > >>

stahta01:

--- Quote from: slenkar on May 18, 2007, 10:39:57 pm ---that worked THANKS


but now it is saying 'undefined reference to enet_initialize()'

I know for a fact that function/command is in the Enet source code.

Is just including the static library enough?

--- End quote ---

This is a little to complex for me to answer, I am a newbie to c++ and have forgotten most of my C language knowledge.
But, I think including static library should be enough.

I am downloading 1.0 version of enet to see if I can see something.

Tim S
 

stahta01:
Are you building the debug or the release version of the projects?

The release compiled for me, but the debug version did not.

Tim S

stahta01:
The below code worked for me in release, but not in debug.


--- Code: ---#include <windows.h>

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

#include "enet/enet.h"
int DLL_EXPORT CALLBACK mymagicfunction(void);


int DLL_EXPORT CALLBACK mymagicfunction(void)
{
       enet_initialize();
}

--- End code ---

stahta01:
As two files below. Works in release not in debug. A lot of the time debug needs windows libraries not on my system to work, it could work on yours.

Remember to define BUILD_DLL in the project building the DLL.

Tim S


--- Code: ---// dll.h

#ifndef DLL_H_INCLUDED
#define DLL_H_INCLUDED

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

#ifdef __cplusplus
extern "C" {
#endif
int DLL_EXPORT CALLBACK mymagicfunction(void);
#ifdef __cplusplus
}
#endif

#endif // DLL_H_INCLUDED


--- End code ---


--- Code: ---#include <windows.h>
#include "dll.h"
#include "enet/enet.h"

int DLL_EXPORT CALLBACK mymagicfunction(void)
{
       enet_initialize();
}


--- End code ---

slenkar:
thanks
how do you put it in release mode?

and which files do I add to the project?

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version