Skip to content

Cantro93/ntry

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ntry - better C++ entrypoints

This library defines new entrypoints designed for usage in C++ programs:

NOTE: is loaded automatically

ntry

int ntry(vector<string> args, string cwd);

It is intended to be used instead of standard main.

_wntry

int _wntry(vector<wstring> args, wstring cwd);

Unicode (wchar_t) variant of ntry

msntry

int msntry(vector<string> args, string cwd, vector<string> envs);

Provides environmental variables (char* envp[]). Use on Windows.

_wmsntry

int _wmsntry(vector<wstring> args, wstring cwd, vector<wstring> envs);

Unicode (wchar_t) variant of msntry.

Example

#include <iostream>
#include "ntry" //name of header is same as entrypoint's name, e. g. _wntry declares _wntry entrypoint

using namespace std;

int ntry(vector<string> args, string cwd)
{
    cout << "Hello world from NTRY entrypoint!" << endl;
    cout << "Command line: \n";
    for (string& arg : args)
        cout << arg << ' ';
    cout << endl << "CWD: \"" << cwd << '"' << endl;
    return 0;
}

About

Upgraded entrypoint for C++ apps

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages