Позвольте мне вкратце объяснить, что я пытаюсь выполнить sh здесь ...
Я использовал подход удаленного вызова процедур (RP C) для разработки клиентского приложения на C ++ и Серверное приложение также на C ++. Клиент 64-битный, а Сервер 32-битный. Целью этих усилий было использование клиента для передачи переменных в функции на стороне сервера. Затем сервер будет использовать 32-битный файл .dll для обработки полученных данных и возврата возвращенных значений клиенту. Этот процесс работает очень хорошо, и я не могу быть счастливее с ним.
Я работаю с 64-битным приложением, которое было разработано в C# и имеет класс stati c для отправки переменных в .dll и возвращая выведенные значения. Поскольку это приложение 64-разрядное, оно не может быть подключено к 32-разрядному .dll (duh), необходимому для этих вычислений.
Теперь на мой вопрос ...
Есть ли способ, которым я Можно ли сохранить процесс, который я уже разработал в C ++, и получить доступ к 32-битному Серверу из 64-битного проекта C#? Есть ли лучший подход для всего этого вместе?
РЕДАКТИРОВАТЬ: я должен также включить, я использую rpcrt4.lib, и вот мой пример кода клиента.
int main()
{
RPC_STATUS status;
unsigned char* szStringBinding = NULL;
char temppath[MAX_PATH] = {0};
// Creates a string binding handle.
// This function is nothing more than a printf.
// Connection is not done here.
status = RpcStringBindingCompose(
NULL, // UUID to bind to.
reinterpret_cast<unsigned char*>("ncacn_ip_tcp"), // Use TCP/IP
// protocol.
reinterpret_cast<unsigned char*>("localhost"), // TCP/IP network
// address to use.
reinterpret_cast<unsigned char*>("4747"), // TCP/IP port to use.
NULL, // Protocol dependent network options to use.
&szStringBinding); // String binding output.
if (status)
exit(status);
// Validates the format of the string binding handle and converts
// it to a binding handle.
// Connection is not done here either.
status = RpcBindingFromStringBinding(
szStringBinding, // The string binding to validate.
&hRPCProjectBinding); // Put the result in the implicit binding
// handle defined in the IDL file.
if (status)
exit(status);
RpcTryExcept
{
// Calls the RPC function. The hRPCProjectBinding binding handle
// is used implicitly.
// Connection is done here.
Output((unsigned char*)"Implcicit RPC Server Call from Client ");
system("PAUSE");
ShutDown();
}
RpcExcept(1)
{
std::cerr << "Runtime reported exception " << RpcExceptionCode()
<< std::endl;
}
RpcEndExcept
// Free the memory allocated by a string.
status = RpcStringFree(
&szStringBinding); // String to be freed.
if (status)
exit(status);
// Releases binding handle resources and disconnects from the server.
status = RpcBindingFree(
&hRPCProjectBinding); // Frees the implicit binding handle defined in
// the IDL file.
if (status)
exit(status);
}
Это учебное пособие, которым я следовал при разработке этого проекта:
Введение в RP C - часть 1
Любые справочные материалы , вход или критика очень ценится.
Спасибо, что нашли время, чтобы прочитать это и за любые рекомендации.