NO

Author Topic: exports  (Read 2600 times)

peter2005

  • Guest
exports
« on: April 27, 2017, 09:49:40 PM »
Hi, I want to create lib/dll with exports from already existing c code, so I placed this dll snippet into the code and both functions plusI and plusF are exported fine.

Code: [Select]
BOOL APIENTRY DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
    switch (fdwReason)
    {
        case DLL_PROCESS_ATTACH:  break;
        case DLL_THREAD_ATTACH:   break;
        case DLL_THREAD_DETACH:   break;
        case DLL_PROCESS_DETACH:  break;
    }
    return TRUE;
}

__declspec(dllexport) int  __cdecl plusI(int a, int b) {  return a + b;  }

__declspec(dllexport) double  __cdecl plusF(double a, double b) {  return a + b;  }

However when I add __declspec(dllexport) int  ... to any other function from the original code  there is no error but the export in created dll does not exist.  :(
« Last Edit: April 28, 2017, 01:41:39 PM by frankie »

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 2113
Re: exports
« Reply #1 on: April 28, 2017, 01:41:01 PM »
Hi, I want to create lib/dll with exports from already existing c code, so I placed this dll snippet into the code and both functions plusI and plusF are exported fine.
In which code? In the library? or this is a new sample library?

Code: [Select]
BOOL APIENTRY DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
    switch (fdwReason)
    {
        case DLL_PROCESS_ATTACH:  break;
        case DLL_THREAD_ATTACH:   break;
        case DLL_THREAD_DETACH:   break;
        case DLL_PROCESS_DETACH:  break;
    }
    return TRUE;
}
__declspec(dllexport) int  __cdecl plusI(int a, int b) {  return a + b;  }

__declspec(dllexport) double  __cdecl plusF(double a, double b) {  return a + b;  }
This is your library?

However when I add __declspec(dllexport) int  ... to any other function from the original code  there is no error but the export in created dll does not exist.  :(
Which original code?
Do you mean that your sample library works and some other code not?

Sorry, but is not clear at all.
Post a sample minimal project that shows the problem.
« Last Edit: April 28, 2017, 01:42:39 PM by frankie »
"It is better to be hated for what you are than to be loved for what you are not." - Andre Gide