I have been looking for answers to my problems, but it seems that most people are interested in passing std :: string across .dll borders. But I'm more interested in using std :: string in a class that is in the DLL that I am creating.
I am releasing my .dll (via email) to a group of people in a forum where I am single, so my question is: can you use std :: string in a .dll without having restrictions, such as a compiler, that should be the same same, version, CRT should be the same, etc.
Can you give examples of what is unsafe and what is safe?
Example: Was it safe to use the “bootloader” to use the SetSender function?
Mail.h
class _declspec(dllexport) Mail {
struct ENVELOPE {
std::wstring SenderEmail;
LPWSTR SenderName;
}Envelope;
public:
int SetSender(LPWSTR SenderEmail);
Mail();
~Mail();
};
Mail.cpp
#include "stdafx.h"
#include "Mail.h"
int CoffeeBeans::Mail::SetSender(LPWSTR Email) {
if (Email == nullptr || lstrcmp(Email, L"") == 0) {
throw L"Email was either nullptr or empty.";
}
this->Envelope.SenderEmail = SenderEmail;
return 0;
}