Click here to Skip to main content
16,017,857 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
RantRe: Message Mapping - VC++ 6.0 into Studio 2005 Pin
Roger Stoltz6-Nov-08 2:00
Roger Stoltz6-Nov-08 2:00 
QuestionBrowse for folder new folder path Pin
Royce Fickling5-Nov-08 7:59
Royce Fickling5-Nov-08 7:59 
QuestionRe: Browse for folder new folder path Pin
David Crow5-Nov-08 8:02
David Crow5-Nov-08 8:02 
AnswerRe: Browse for folder new folder path Pin
Royce Fickling5-Nov-08 9:48
Royce Fickling5-Nov-08 9:48 
QuestionRe: Browse for folder new folder path Pin
David Crow5-Nov-08 9:52
David Crow5-Nov-08 9:52 
AnswerRe: Browse for folder new folder path Pin
Royce Fickling5-Nov-08 10:07
Royce Fickling5-Nov-08 10:07 
GeneralRe: Browse for folder new folder path Pin
David Crow5-Nov-08 10:11
David Crow5-Nov-08 10:11 
QuestionProplem with a static library Pin
Stonie965-Nov-08 5:42
Stonie965-Nov-08 5:42 
Good day, i'm having a proplem with a static library i'm creating. But before i'll go into the details of the library i'm gonna give you some details about the app that is importing it.

But basicly this is a raw exe. All standard libraries such as the default C Runtime Libraries are not included. Which means i have to declare my own entrypoint for the application which looks like this.

#pragma comment(lib, "SkyNet_RTL.lib")
#include <windows.h>
#include "SkyNetLoader.h"
#include "..\SkyNet_RTL\SkyNet_RTL.h"

void __stdcall __SkyNetLoaderEntry()
{
	_SkyNet_RTL_INIT();
	//hSkyNetLoaderModule = GetModuleHandleW(NULL);
	//LPWSTR lpszCommandLine = GetCommandLineW();
	int entry_ret = 1; // __SkyNetLoaderFunc(hSkyNetloaderModule, lpszCommandLine);
	ExitProcess(entry_ret);
}
</windows.h>


The only libraries that link with the application is kernel32.dll and ntdll.dll which actually link to all applications.
Don't know if it matters but that standard calling convention for the exe is __stdcall and __cdecl for the static library.

The function _SkyNet_RTL_INIT(); is a function implemented in the static library called SkyNet_RTL.dir (Skynet Runtime library). As you see i've included the SkyNet_RTL.lib in the pragma comment directive so it should be linked into the build.
The header file for the static lib IS the same file for both the application and the static library.
The Compiler puts the .lib file and the export file into the folder containing the .exe so it should be present for the linker to grab.
The static lib project is a dependency for the application so if there are any changes to the lib it's rebuilt and put into the application project's folder for linking before the application itself is built.

Here's the header file for the static library

////////////// SKYNET RUNTIME LIBRARY HEADER ///////////////////////////
//#pragma comment(lib, "SkyNet_RTL.lib")
#ifndef __SKYNET_RUNTIME_LIBRARY_V01
#define __SKYNET_RUNTIME_LIBRARY_V01

bool __cdecl _SkyNet_RTL_INIT(void);

//#define SkyNetRTL_Initialize() _SkyNet_RTL_INIT()

#endif


Plain and simple. _SkyNet_RTL_INIT(void) is implemented in SkyNet_RTL.cpp like this
#include "SkyNet_RTL.h"

//typedef int BOOL

bool __cdecl _SkyNet_RTL_INIT(void)
{
	return true;
}


The static library is also a completely raw library, which excludes all standard libraries for linking (CRT, etc). But right now the symbols dont seem to be exported. I've messed around with the settings alot and i constantly get.

SkyNet Loader error LNK2019: unresolved external symbol "bool __cdecl _SkyNet_RTL_INIT(void)" (?_SkyNet_RTL_INIT@@YA_NXZ) referenced in function "void __stdcall __SkyNetLoaderEntry(void)" (?__SkyNetLoaderEntry@@YGXXZ)

Atm i dont see anything wrong, i've gone trough quick articles on static libraries and none seem to do anything other then what i'm doing here excluding the fact that my lib and app are completely raw (my compiler/linker settings have been modified alot, no RunTime checks, etc).
The lib and export files are present for the application to be linked with.

If someone can point me in the right direction it would be greatly appreciated, and btw if you are wondering why the explicit __cdecl in the library function it was because i thought perhaps the calling conventions could change something, it was originally made __stdcall by the compiler even though the standard calling convention for this build is __cdecl.
AnswerRe: Proplem with a static library Pin
Stonie965-Nov-08 7:46
Stonie965-Nov-08 7:46 
QuestionWrite to excel Pin
hellogany5-Nov-08 3:30
hellogany5-Nov-08 3:30 
AnswerRe: Write to excel Pin
achainard5-Nov-08 4:00
achainard5-Nov-08 4:00 
GeneralRe: Write to excel Pin
hellogany5-Nov-08 16:11
hellogany5-Nov-08 16:11 
GeneralRe: Write to excel Pin
achainard5-Nov-08 23:35
achainard5-Nov-08 23:35 
AnswerRe: Write to excel Pin
David Crow5-Nov-08 6:05
David Crow5-Nov-08 6:05 
Questionhow to get the HWND from the windows on the "locked screen" Pin
Krzysztof Gorgolewski5-Nov-08 3:21
Krzysztof Gorgolewski5-Nov-08 3:21 
AnswerRe: how to get the HWND from the windows on the "locked screen" Pin
Iain Clarke, Warrior Programmer5-Nov-08 4:52
Iain Clarke, Warrior Programmer5-Nov-08 4:52 
GeneralRe: how to get the HWND from the windows on the "locked screen" Pin
SandipG 5-Nov-08 5:25
SandipG 5-Nov-08 5:25 
QuestionRe: how to get the HWND from the windows on the "locked screen" Pin
David Crow5-Nov-08 6:07
David Crow5-Nov-08 6:07 
QuestionRe: how to get the HWND from the windows on the "locked screen" Pin
Roger Stoltz5-Nov-08 6:36
Roger Stoltz5-Nov-08 6:36 
AnswerRe: how to get the HWND from the windows on the "locked screen" Pin
SimonSays5-Nov-08 7:37
SimonSays5-Nov-08 7:37 
QuestionRe: how to get the HWND from the windows on the "locked screen" Pin
Krzysztof Gorgolewski5-Nov-08 8:11
Krzysztof Gorgolewski5-Nov-08 8:11 
RantRe: how to get the HWND from the windows on the "locked screen" Pin
Krzysztof Gorgolewski5-Nov-08 8:31
Krzysztof Gorgolewski5-Nov-08 8:31 
QuestionRe: how to get the HWND from the windows on the "locked screen" Pin
Krzysztof Gorgolewski5-Nov-08 18:42
Krzysztof Gorgolewski5-Nov-08 18:42 
AnswerRe: how to get the HWND from the windows on the "locked screen" Pin
SandipG 5-Nov-08 20:49
SandipG 5-Nov-08 20:49 
NewsRe: how to get the HWND from the windows on the "locked screen" Pin
Krzysztof Gorgolewski5-Nov-08 21:21
Krzysztof Gorgolewski5-Nov-08 21:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.