Roboman Robo
Roboman Robo

Reputation: 689

How to share a single C++ variable through a dll?

I have a C++ file that outputs a string. How can I pass the string value to another file using a dll?

Code:

file name "importedfilewithvariable.h"

#include <string>

    int main(){
        std::string texttosend = "Hello World";
    
    
    }

File importing variable

#include <iostream>
#include importedfilewithvariable.h

int main(){
    std::cout << texttosend;


}
 

Upvotes: 0

Views: 83

Answers (0)

Related Questions