I made it look alike in MSVC++, but i am having a few problem to look exactly.
This is working part of my code, this is header.h:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
///.H
#pragma once
#ifndef __MYCLASS_H
#define __MYCLASS_H
#pragma once
#ifdef MATHLIBRARY_EXPORTS
#define MATHLIBRARY_API __declspec(dllexport)
#else
#define MATHLIBRARY_API __declspec(dllimport)
#endif
#include <iostream>
#include <vector>
namespace namespaced {
using namespace std;
enum ClientError { HIDController = 1, UVCController = 2 };
class Client {
private:
ClientError _controller;
public:
Client();
~Client();
ClientError MATHLIBRARY_API SetCallbackClass(class Callbacks * scc);
};
};
#endif
|
and cpp:
1 2 3 4 5 6 7
|
#include "Header.h"
namespace namespaced {
ClientError Client::SetCallbackClass(class Callbacks * scc) {
return _controller;
}
}
|
tthis is what i get when compile dll file
demangled function name is:
public: enum namespaced::ClientError __thiscall namespaced::Client::SetCallbackClass(class namespaced::Callbacks *)
and mangled:
?SetCallbackClass@Client@namespaced@@QAE?AW4ClientError@2@PAVCallbacks@2@@Z
but this is what i need, unmangled function name:
public: enum namespace::ClientError __thiscall Client::SetCallbackClass(class Callbacks *)
and mangled:
?SetCallbackClass@Client@@QAE?AW4ClientError_t@namespaced@@PAVCallbacks@@@Z
So basically i need to get rid of namespaced before class names(callbacks and Client)
Second problem i have is,i get warning "
|
Warning C4273 'namespaced::Client::SetCallbackClass': inconsistent dll linkage testingdll
|
What does this mean? I also get "is not a valid win32 application when i compile dll" i am guessing that is because of this warning?
And third problem i have is writing this:
public: static class Client * __cdecl Client::GetInstance(void)
i managed to make it look like this
public: static class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl namespaced::Client::GetInstance(void)
So basically i need 'Client' instead of "std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >"
This i part of code i am using this is in header file-class Client:
static string MATHLIBRARY_API GetInstance();
and in cpp:
1 2 3
|
string Client::GetInstance() {
return "anytext";
}
|
I think i need to replace string with class, but i don't know what i need to return?
Any help is appreciate.