Created
January 16, 2019 00:42
-
-
Save kripken/23c0e8749971d727cc402e2b513aa429 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@needs_dlfcn | |
def test_dylink_global_ctor_and_stack(self): | |
# a global ctor in the main module must not call a side module before the side module is | |
# all set up - otherwise, the stack may be in the wrong place. | |
self.emcc_args += ['-g'] | |
with env_modify({'EMCC_FORCE_STDLIBS': 'libc++'}): | |
self.dylink_test(header=r''' | |
#include<string> | |
const int gStudent = 10; | |
class Student{ | |
private: | |
std::string name; | |
public: | |
Student(std::string); | |
virtual void display(); | |
}; | |
const Student gOneStudent("gOneStudent"); | |
''', main=r''' | |
#include "header.h" | |
#include <iostream> | |
using namespace std; | |
int main(int argc, char *argv[]){ | |
Student s("Angad"); | |
s.display(); | |
cout <<"\ngStudent=" << gStudent << std::flush; | |
cout << std::endl; | |
return 0; | |
} | |
''', side=r''' | |
#include <iostream> | |
#include "header.h" | |
using namespace std; | |
Student::Student(string name):name(name){} | |
void Student::display(){ | |
cout << "A student with name " << this->name << endl; | |
}''', expected=['A student with name Angad']) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment