Find Jobs
Hire Freelancers

Visual Studio C++ DLL using managed code

€30-250 EUR

Fechado
Publicado há mais de 5 anos

€30-250 EUR

Pago na entrega
Hi, I'm a programmer, but not a C++ programmer. I'm really looking for someone who can look at my example code and immediately knows what to do. I don't need someone who has to go away and look it up on Google - because I can do that myself. I'm using Microsoft Visual Studio 2015 with /clr. C++. I'm writing a DLL. I've written lots of unmanaged code like this, but now I'd like to incorporate some managed code, but I'm having problems combining the two. I've attached some simplified code, with an example of opening, writing and closing a file using managed code. I call my DLL from a 3rd party app (I have no control over this 3rd party app). This app creates a single memory space for the DLL. In order to call the DLL multiple times with separate settings I create a class and use a pointer to that class for subsequent calls. The pointer is then stored in the ->Tag of the object from the 3rd party app (as an int). The order of calling the DLL is xCreateClass myTest_open myTest_write myTest_close xDestroyClass The code below doesn't work because I'm redeclaring StreamWriter^ sw with each DLL call. With unmanaged code I would put this file declaration in the public: scope of the myData class. But with managed code it won't allow this. Looking on the internet it says I should declare my class with a ref statement ref class myData But when I do this it throws lots of errors around the use of my data pointers in the DLL calls. So I think what I need is that my data pointers should be rewritten in managed code, but I don't know how to do this. I say I think because I'm a bit lost right now and maybe there is a different way to do this. So hopefully you look at this code and think 'that's easy'! If we go ahead I can send you the VS project. Thanks //Used to connect with 3rd party app #import "[login to view URL]" no_namespace #using <[login to view URL]> using namespace System; using namespace System::IO; #pragma unmanaged BOOL APIENTRY DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) { switch (ul_reason_for_call) { case DLL_PROCESS_ATTACH: case DLL_THREAD_ATTACH: case DLL_THREAD_DETACH: case DLL_PROCESS_DETACH: break; } return TRUE; } #pragma managed class myData { public: //variable definitions //StreamWriter^ sw; //this declaration needs to be here, but it isn't allowed here myData() { //variable declarations } void xx_open() { StreamWriter^ sw; String^ path; path = Environment::CurrentDirectory + "\\[login to view URL]"; if (System::IO::File::Exists(path)) System::IO::File::Delete(path); sw = gcnew StreamWriter(path); } void xx_write() { StreamWriter^ sw; //redeclaring - doesn't work because this call is referencing a different sw from previous xx_open call sw->WriteLine("Hello - Goodbye"); sw->Flush(); } void xx_close() { StreamWriter^ sw; //redeclaring - doesn't work because this call is referencing a different sw from previous xx_open and xx_write calls if (sw != nullptr) { sw->Close(); } } }; //DLL calls int __stdcall xCreateClass(::IEasyLanguageObject * elObjPtr) { myData * myDataPtr = (myData *)elObjPtr->Tag; if (myDataPtr == 0) { myDataPtr = new myData(); elObjPtr->Tag = (__int64)myDataPtr; } return 1; } int __stdcall xDestroyClass(::IEasyLanguageObject * elObjPtr) { myData * myDataPtr = (myData *)elObjPtr->Tag; if (myDataPtr != 0) { delete myDataPtr; elObjPtr->Tag = 0; } return 1; } void __stdcall myTest_open(::IEasyLanguageObject * elObjPtr) { myData * myDataPtr = (myData *)elObjPtr->Tag; if (myDataPtr != 0) { myDataPtr->xx_open(); } } void __stdcall myTest_write(::IEasyLanguageObject * elObjPtr) { myData * myDataPtr = (myData *)elObjPtr->Tag; if (myDataPtr != 0) { myDataPtr->xx_write(); } } void __stdcall myTest_close(::IEasyLanguageObject * elObjPtr) { myData * myDataPtr = (myData *)elObjPtr->Tag; if (myDataPtr != 0) { myDataPtr->xx_close(); } }
ID do Projeto: 18305653

Sobre o projeto

9 propostas
Projeto remoto
Ativo há 5 anos

Quer ganhar algum dinheiro?

Benefícios de ofertar no Freelancer

Defina seu orçamento e seu prazo
Seja pago pelo seu trabalho
Descreva sua proposta
É grátis para se inscrever e fazer ofertas em trabalhos
9 freelancers estão ofertando em média €161 EUR for esse trabalho
Avatar do Usuário
Hi, Dear Employer! I am really interested in your project. I have enough experience in Python, C/C++, C#, java programming. I am 100% sure I can satisfy your requirements perfectly. Clear Algorithm Will Encourage Your Project. I want a long-term relationship with you. Thank you and best regards!
€200 EUR em 3 dias
4,9 (57 avaliações)
7,0
7,0
Avatar do Usuário
How are you. Nice to meet you. I am very interested in your requirements. I have the ability to fulfill your requirements. If you hire me, I will work hard and you will get good results. Thank you
€155 EUR em 3 dias
5,0 (24 avaliações)
6,7
6,7
Avatar do Usuário
Hello. I have rich experiences with C/C++ programming. I can do this work with high quality. I am ready to take your project now. Lets discuss details over chat.
€155 EUR em 3 dias
4,9 (75 avaliações)
6,6
6,6
Avatar do Usuário
I am very proficient in java. I have 16 years java developing experience now, and have worked for more than 7 years. My work is online game developing, and mainly focus on server side, using java under Linux environment. I made many great projects using java, for example, I made the tools which could convert java files into c++ scripts, of course garbage collection included, this job was very similar to a compiler, and was very complex. I also made our own mobile game using java, I can show you the demo of client, if you like. I have a very good review on Freelancer.com, I never miss a project once I accept the job, you can check my review. Trust me, please let expert help you. Besides, I am very proficient in c++ also, hope I can help you.
€50 EUR em 1 dia
4,8 (101 avaliações)
6,7
6,7
Avatar do Usuário
Hello, I am C++ expert and interested in this project. I have reviewed details of your project and confident to handle it perfectly. Can you please share visual studio project so I can check it. Please communicate to discuss further. Regards, Anshu
€125 EUR em 3 dias
4,7 (196 avaliações)
6,5
6,5
Avatar do Usuário
Hello, friend I am an expert in c/c++. I have already checked your description. I can help you definitely. Please send me a message so that we can discuss more details. Thanks.
€250 EUR em 3 dias
5,0 (14 avaliações)
5,2
5,2
Avatar do Usuário
Hi, I can show to you a method that you can solve this problem very quickly. Please chat me and let me teach you
€200 EUR em 0 dia
5,0 (2 avaliações)
1,8
1,8
Avatar do Usuário
Cuéntame tu problema e iremos viendo. Es la primera vez que me meto en Freelancer, y no se muy bien que hacer. Entregame el codigo que tienes con la descripción del problema en castellano. Y valorare con tranquilidad que me puede llevar. Siendo la primera vez no sabría por cuanto hacer la oferta. Pero hay que aprender. Gracias.
€155 EUR em 10 dias
0,0 (0 avaliações)
0,0
0,0
Avatar do Usuário
Good to start work on C++ As Having 13+ years of experience in analysis, design, develop, manage and implementation of large C++ IT projects.
€155 EUR em 3 dias
0,0 (0 avaliações)
0,0
0,0

Sobre o cliente

Bandeira do(a) SPAIN
La Orotava, Spain
0,0
0
Membro desde dez. 6, 2018

Verificação do Cliente

Obrigado! Te enviamos um link por e-mail para que você possa reivindicar seu crédito gratuito.
Algo deu errado ao enviar seu e-mail. Por favor, tente novamente.
Usuários Registrados Total de Trabalhos Publicados
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Carregando pré-visualização
Permissão concedida para Geolocalização.
Sua sessão expirou e você foi desconectado. Por favor, faça login novamente.