main

Mixed-mode C++/CLI crashing: heap corruption in atexit (static destructor registration)

纵饮孤独 提交于 2020-01-03 15:17:24
问题 I am working on deploying a program and the codebase is a mixture of C++/CLI and C#. The C++/CLI comes in all flavors: native, mixed ( /clr ), and safe ( /clr:safe ). In my development environment I create a DLL of all the C++/CLI code and reference that from the C# code (EXE). This method works flawlessly. For my releases that I want to release a single executable (simply stating that "why not just have a DLL and EXE separate?" is not acceptable). So far I have succeeded in compiling the EXE

Return a string from function to main

…衆ロ難τιáo~ 提交于 2020-01-03 06:34:12
问题 I want to return a string from a function (in the example funzione ) to main. How to do this? Thank you! #include <stdio.h> #include <string.h> #define SIZE (10) /* TODO*/ funzione (void) { char stringFUNC[SIZE]; strcpy (stringFUNC, "Example"); return /* TODO*/; } int main() { char stringMAIN[SIZE]; /* TODO*/ return 0; } [EDITED] For those who need it, the complete version of the previous code (but without stringMAIN ) is: #include <stdio.h> #include <stdlib.h> #include <string.h> #define

Return a string from function to main

两盒软妹~` 提交于 2020-01-03 06:34:07
问题 I want to return a string from a function (in the example funzione ) to main. How to do this? Thank you! #include <stdio.h> #include <string.h> #define SIZE (10) /* TODO*/ funzione (void) { char stringFUNC[SIZE]; strcpy (stringFUNC, "Example"); return /* TODO*/; } int main() { char stringMAIN[SIZE]; /* TODO*/ return 0; } [EDITED] For those who need it, the complete version of the previous code (but without stringMAIN ) is: #include <stdio.h> #include <stdlib.h> #include <string.h> #define

Call a method of running jar from batch

青春壹個敷衍的年華 提交于 2020-01-03 06:27:14
问题 i have a Java application, which's main-function is called from a batch file witch 2 parameters. Now i want to pass another pair of parameters to the same app and not open another instance. Is it possible to call the main-function (or any other) of a running jar file from outside? Thank you for your help! 回答1: You should probably do this using JMX, as I mentioned in my comment. JMX allows you to expose "management beans" from you program that can then be invoked remotely. Lets start with a

Error: Could not find or load main class org.apache.flume.node.Application - Install flume on hadoop version 1.2.1

守給你的承諾、 提交于 2020-01-03 05:59:07
问题 I have built a hadoop cluster which 1 master-slave node and the other is slave. And now, I wanna build a flume to get all log of the cluster on master machine. However, when I try to install flume from tarball and I always get: Error: Could not find or load main class org.apache.flume.node.Application So, please help me to find the answer, or the best way to install flume on my cluster. many thanks! 回答1: It is basically because of FLUME_HOME.. Try this command $ unset FLUME_HOME 回答2: I know

The return type of main() function [duplicate]

孤者浪人 提交于 2020-01-02 23:21:02
问题 This question already has answers here : What should main() return in C and C++? (17 answers) Closed 6 years ago . I get this code: #include<stdio.h> #include<stdlib.h> void main(void) { char *ptr = (char*)malloc(10); if(NULL == ptr) { printf("\n Malloc failed \n"); return; } else { // Do some processing free(ptr); } return; } It compiles successfully in Visual C, but do not compile in gcc, I get "error:'main' must return 'int'". So is the return type 'int' of main() function is a convention

Is main() a User-Defined Function? [duplicate]

自古美人都是妖i 提交于 2020-01-02 10:07:23
问题 This question already has answers here : main() in C, C++, Java, C# (9 answers) Closed 4 months ago . The programmer does define what happens inside main() , after all. So, should it be considered a user-defined function? 回答1: The C++ standard doesn't have the notion of user-defined functions. Instead, it has the notion of library functions . main is not a library function. However, the standard also imposes some requirements on its signature, and that it must not be overloaded or declared

can we have a main() in an interface and different implementations for main() in the classes that implement this interface?

六月ゝ 毕业季﹏ 提交于 2020-01-02 01:36:35
问题 I know that main() can be overloaded in a class with the compiler always taking the one with String[] args as arguments as the main method from where the execution starts. But is it possible to declare the same main(String args[]) in an interface and implement it in different classes differently? For example, package test; interface test { public void main(String args[]); public void display(); } package test; class Testclass1 implements test { public void display() { System.out.println(

How to move main method to another class in Scala?

笑着哭i 提交于 2020-01-02 01:21:10
问题 IntelliJ IDEA 10.5 (probably this matters). I am new to Scala, so I started in an akward way. I created one file with two classes -- empty MainApp and another class, HelloWorld with method main. I compiled it and executed -- IntelliJ automatically detected HelloWorld as main class. It was OK. Then, I moved main method to MainApp, and deleted (then empty) HelloWorld class. When I tried to run it, IntelliJ sticked to HelloWorld nevertheless. So I reconfigured project and selected MainApp as

How many arguments does main() have in C/C++

心不动则不痛 提交于 2020-01-01 09:00:02
问题 What numbers of arguments are used for main ? What variants of main definition is possible? 回答1: C++ Standard: (Source) The C++98 standard says in section 3.6.1.2 It shall have a return type of type int, but otherwise its type is implementation-defined. All implementations shall allow both the following definitions of main: int main() and int main(int argc, char* argv[]) Commonly there are 3 sets of parameters: no parameters / void int argc, char ** argv int argc, char ** argv, char ** env