Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
29
Добавлен:
12.03.2015
Размер:
2.16 Кб
Скачать
#include "mcadincl.h"
    
    
LRESULT cmplxsumFunction(   LPCOMPLEXSCALAR     c,
                                LPCCOMPLEXSCALAR    a,
                                LPCCOMPLEXSCALAR    b   );

    FUNCTIONINFO    cmplxsum = 
    { 
    "cmplxsum",                         // Name by which mathcad will recognize the function
    "a,b",                              // cmplxsum will be called as cmplxsum(a,b)
    "complex sum of scalars a and b",       // description of cmplxsum(a,b)
    (LPCFUNCTION)cmplxsumFunction,      // pointer to the executible code
    COMPLEX_SCALAR, 
    2,                  // the return type is also a complex scalar
    { COMPLEX_SCALAR, COMPLEX_SCALAR}   // both arguments are complex scalars
    };
    

    
    // this code executes the addition
    LRESULT cmplxsumFunction(   LPCOMPLEXSCALAR     c,  //put return value here
                                LPCCOMPLEXSCALAR    a,  // 1st argument
                                LPCCOMPLEXSCALAR    b   ) // 2nd argument
    {
        
        //  add real parts of a and b
        //  and put them into c
        c->real = a->real + b->real;
        c->imag = a->imag + b->imag;
        
        
        return 0;               // return 0 to indicate there was no error
            
    }           
    
BOOL WINAPI _CRT_INIT(HINSTANCE hinstDLL, DWORD dwReason, LPVOID lpReserved);

BOOL WINAPI DllEntryPoint (HANDLE hDLL, DWORD dwReason, LPVOID lpReserved)
{
  switch (dwReason)
  {
    case DLL_PROCESS_ATTACH:         // DLL is attaching to the address space of the current process.

      if (!_CRT_INIT(hDLL, dwReason, lpReserved)) 
        return FALSE;
    
        CreateUserFunction( hDLL, &cmplxsum ); 
      break;

    case DLL_THREAD_ATTACH:         // A new thread is being created in the current process.
    case DLL_THREAD_DETACH:        // A thread is exiting cleanly.
    case DLL_PROCESS_DETACH:      // The calling process is detaching the DLL from its address space.

      if (!_CRT_INIT(hDLL, dwReason, lpReserved)) 
        return FALSE;
      break;

  }
  return TRUE;
}

Соседние файлы в папке cmplxsum
  • #
    12.03.20152.16 Кб29CMPLXSUM.C
  • #
    12.03.20152.03 Кб29CMPLXSUM.MAK
  • #
    12.03.201542 б29COMPILE.BAT
  • #
    12.03.201597 б29LINKME.BAT