   passing values from exe to dll c++
  so I have this executable which takes values from a joystick and outputs those values (i have the code). I want to pass those values to a dll, which is read in a program (i have the code for the dll). how can I pass those values from the exe to the dll? (by the way, i'm a kinda beginner)   
  Well for starters is this a DLL of which you created or is it third party?  A couple of things to know here is there are a few ways of exporting functions, the  __declspec(dllexport)  way and the  .def definition  file way.  To know which functions are being exported from a Dll you can use the command line and run Dumpbin.  You will need to look into decorated names and "C" style naming which is not decorated.  There is a fair bit to go over and most of it can be found on  msdn .  You will also want to look into  LoadLibrary(Ex)  and function pointers if you are not already familiar.  I am not exactly sure how much of this is language specific to C++ and Windows(I'm pretty sure there are no other OS using the Dll system??) systems as I haven't spent much time elsewhere.   ;  Hm, it could be simple  - you can add the DLL to your project (where your exe is ) , compile,include the needed header file  and then just call the relevant functions with parameters..But your question is very general - to get better answer be more specific about programming environment, OS and type of DLLs   ;  well, I'm working with visual studio .NET, C++, win7. What I'm trying to do here is plugin development for MotionBuilder. I got some code here, it's an application that reads values from the joystick, and displays them in a windows form.Also, I have sample code(templates) that came with MotionBuilder plugin sdk. What I'd like, is to pass those values from the joystick, into the MotionBuilder plugin.   ;  The specific topic you're looking for is IPC (inter-process communication).  If all you need is to pass is a couple of primitive values, a shared data segment is simple and easy.  If your program loads a copy of the DLL at the same time as this other program which loads it as a plugin, you'd simply have something like this:#pragma data_seg (".SHARED")intg_joyx = 0;intg_joyy = 0;#pragma data_seg()#pragma comment(linker, "/section:.SHARED,RWS")in your DLL code.  Now, whenever you change g_joyx or g_joyy in any process that has this DLL loaded, it will change for all processes.  If there's potential for two processes to be writing to this value at the same time, you'll have to set up some write protection (using a mutex or similar, for example).Export a couple functions to read/write these values from the DLL and you'd be set.On the other hand, if you need to transfer more complex information (such as non-primitives or anything that involves a pointer), you'd want to use shared memory.  Boost makes this really easy to do.   ;  thx for your help, but since i'm very beginner in C++, I need some clarification.Quote:in any process that has this DLL loadeddoes that mean I have to include that MotionBuilder plugin dll source code file to my joystic project (joystick project is the cpp which reads from the joystick)?also, what do you mean by "exporting functions"?   ;Quote:Original post by souskesiahhthx for your help, but since i'm very beginner in C++, I need some clarification.Quote:in any process that has this DLL loadeddoes that mean I have to include that MotionBuilder plugin dll source code file to my joystic projectNo, it merely needs a copy of the DLL in memory solely for the purpose of changing the shared data segment in other instances of the DLL.  Write your plugin DLL, then create a header file describing exported functions.  It might look something like this:#ifdef MYPLUGIN_EXPORTS#define PLUGINFN __declspec(dllexport)#else#define PLUGINFN __desclspec(dllimport)#endifPLUGINFNintMyPlugin_GetJoyX();PLUGINFNintMyPlugin_GetJoyY();PLUGINFNvoidMyPlugin_SetJoyX(int x);PLUGINFNvoidMyPlugin_SetJoyY(int y);Build your plugin DLL with MYPLUGIN_EXPORTS defined.  Go back to your joystick project and include the header file you created somewhere where you want to change shared values.  Go to your linker settings and make sure the import library (probably named MyPlugin.lib) created by your plugin project is included as input.Now, whenever you want to change the x and y values in your plugin from your joystick program, you just need to set them using MyPlugin_SetJoyX/Y.This article might help.   ;  in my joystick project, i get this errorerror C3861: 'MyPlugin_SetJoyX': identifier not founderror C3861: 'MyPlugin_SetJoyY': identifier not foundHere's what I did. I copy pasted your code in a header that I created in my MotionBuilder plugin project. Then, I defined MyPlugin_SetJoyX and MyPlugin_SetJoyY right after the #includes on top of my .cxx file of my plugin project (i also declared the 2 int variables that i mess with after the #includes)save, compile, fine.Then, I opened my joystick project, added the header file, and called those 2 functions from within joystick.cpp, and it gives me those 2 errors.   ;  According to the compiler, you didn't define those functions or it has no idea what you're talking about when you refer to them.  You #include'd that header in the joystick cpp file before you tried to use them, right?   ;  omg I forgot to include the header in my cpp file o_0but now i get a weird error..error LNK2019: unresolved external symbol "__declspec(dllimport) void __cdecl MyPlugin_SetRotX(double)" (__imp_?MyPlugin_SetRotX@@YAXN@Z) referenced in function "long __cdecl UpdateInputState(struct HWND__ *)" (?UpdateInputState@@YAJPAUHWND__@@@Z)by the way, I changed the function names for rotation, and the variables to double   