Find Jobs
Hire Freelancers

Visual Studio C++ DLL using managed code

€30-250 EUR

Cerrado
Publicado hace más de 5 años

€30-250 EUR

Pagado a la 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 del proyecto: 18305653

Información sobre el proyecto

9 propuestas
Proyecto remoto
Activo hace 5 años

¿Buscas ganar dinero?

Beneficios de presentar ofertas en Freelancer

Fija tu plazo y presupuesto
Cobra por tu trabajo
Describe tu propuesta
Es gratis registrarse y presentar ofertas en los trabajos
9 freelancers están ofertando un promedio de €161 EUR por este trabajo
Avatar del usuario
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 en 3 días
4,9 (57 comentarios)
7,0
7,0
Avatar del usuario
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 en 3 días
5,0 (24 comentarios)
6,7
6,7
Avatar del usuario
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 en 3 días
4,9 (75 comentarios)
6,6
6,6
Avatar del usuario
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 en 1 día
4,8 (101 comentarios)
6,7
6,7
Avatar del usuario
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 en 3 días
4,7 (196 comentarios)
6,5
6,5
Avatar del usuario
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 en 3 días
5,0 (14 comentarios)
5,2
5,2
Avatar del usuario
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 en 0 día
5,0 (2 comentarios)
1,8
1,8
Avatar del usuario
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 en 10 días
0,0 (0 comentarios)
0,0
0,0
Avatar del usuario
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 en 3 días
0,0 (0 comentarios)
0,0
0,0

Sobre este cliente

Bandera de SPAIN
La Orotava, Spain
0,0
0
Miembro desde dic 6, 2018

Verificación del cliente

¡Gracias! Te hemos enviado un enlace para reclamar tu crédito gratuito.
Algo salió mal al enviar tu correo electrónico. Por favor, intenta de nuevo.
Usuarios registrados Total de empleos 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)
Cargando visualización previa
Permiso concedido para Geolocalización.
Tu sesión de acceso ha expirado y has sido desconectado. Por favor, inica sesión nuevamente.