note: First of all i am using visual studio 2010.
Usually i need dll with some exported functions that i need to use from outside apps..
Normally this is how my dll header looks...
#define DLLAPI extern "C" __declspec(dllexport)
DLLAPI BOOL WINAPI FUNCTION1(...);
DLLAPI BOOL WINAPI FUNCTION2(...);
I don't add any commands to the project or anything, all i do to export them is this in the headers + add DLLAPI to functions in the source file ofc.
Now when i need to get the function name from my outside app its making me problems because its always something like FUNCTION1xa1@assu79sax_ or something like that...
I saw a project which uses .DEF file and makes its headers like...
// INCLUDE FILE generated by "Pelles C for Windows, version 3.00".
#ifndef _HOOK_H
#define _HOOK_H
#ifdef _HOOK_
#define HOOKAPI __declspec(dllexport)
#else
#define HOOKAPI __declspec(dllimport)
#endif /* _HOOK_ */
#ifndef WINAPI
#define WINAPI __stdcall
#endif
HOOKAPI int WINAPI SampleFunction(int, int);
#endif /* _HOOK_H */
and it's .def file looks like...
EXPORTS
SetValuesCBT
SetValuesKey
SetValuesMouse
MouseProc
KeyProc
CBTProc
SECTIONS
.shared READ WRITE SHARED
This results in very clear function names exported aka just as they are called(as proven by dumpbin.exe) btw if matters, it also has .pjj file with following content...
#
# PROJECT FILE generated by "Pelles C for Windows, version 5.00".
# WARNING! DO NOT EDIT THIS FILE.
#
POC_PROJECT_VERSION = 5.00.1#
POC_PROJECT_TYPE = 1#
POC_PROJECT_ARGUMENTS = #
CC = pocc.exe#
AS = #
RC = porc.exe#
LINK = polink.exe#
SIGN = posign.exe#
CCFLAGS = -Tx86-coff -Ot -W1 -Ze -Gz#
ASFLAGS = -c -nologo -coff -W1 -Cu#
RCFLAGS = -r#
LINKFLAGS = -machine:ix86 -subsystem:windows kernel32.lib user32.lib gdi32.lib comctl32.lib comdlg32.lib advapi32.lib delayimp.lib -dll#
WizCreator = Pelle Orinius#
SIGNFLAGS = -location:CU -store:MY -timeurl:http://timestamp.verisign.com/scripts/timstamp.dll -errkill#
INCLUDE = $(PellesCDir)\Include\Win;$(PellesCDir)\Include#
LIB = $(PellesCDir)\Lib\Win;$(PellesCDir)\Lib#
.SILENT:
#
# Build hook.dll.
#
hook.dll: \
output\DLL.obj \
EXPORTS.DEF
$(LINK) $(LINKFLAGS) -out:"$@" $**
#
# Build DLL.obj.
#
output\DLL.obj: \
DLL.C
$(CC) $(CCFLAGS) "$!" -Fo"$@"
.EXCLUDEDFILES:
I don't know how should i emulate this in my VS 2010 project so when i build my dll function names are simple and precise?