Advertisement
Guest User

Untitled

a guest
Sep 20th, 2013
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.62 KB | None | 0 0
  1. Makefile:
  2. # We're only here to build a DLL around the .LIB files that
  3. # Data Translation provides, since Python's ctypes library
  4. # can't work with .LIB. So, here we have a stupid little wrapper that
  5. # simply exports the parts of the .LIB that we need to be able to
  6. # work with.
  7.  
  8. DTROOT = "C:\Program Files (x86)\Data Translation\Win32\SDK"
  9. DTINCLUDE = /I$(DTROOT)\Include
  10. DTLIBS = /LIBPATH:$(DTROOT)\Lib64 oldaapi64.lib OLMEM64.lib Graph64.lib
  11.  
  12. CXXFLAGS = /MD /EHsc /DWIN32 /D_WINDOWS /DNOPCH /O2 $(DTINCLUDE)
  13.  
  14. DTOBJS = dt_wrapper.obj
  15. DTTARGET = dt_wrapper.dll
  16.  
  17. all: $(DTTARGET)
  18.  
  19. $(DTTARGET): $(DTOBJS)
  20. link /dll /DEBUG /NOLOGO /out:$@ /SUBSYSTEM:WINDOWS $(DTOBJS) $(DTLIBS)
  21.  
  22. clean:
  23. del *dll *lib *pdb *obj *exp
  24.  
  25.  
  26. Code:
  27.  
  28. #include "stdio.h"
  29.  
  30. __declspec(dllexport) int printer(void);
  31.  
  32. int printer(void) {
  33. printf("Hello, world!\n");
  34. return 0;
  35. }
  36.  
  37.  
  38. Output:
  39.  
  40. C:\mui\devices\resources\dataTranslationWrapper>nmake /f MAKEFILE
  41.  
  42. Microsoft (R) Program Maintenance Utility Version 10.00.30319.01
  43. Copyright (C) Microsoft Corporation. All rights reserved.
  44.  
  45. cl /MD /EHsc /DWIN32 /D_WINDOWS /DNOPCH /O2 /I"C:\Program Files (x86)\Da
  46. ta Translation\Win32\SDK"\Include /c dt_wrapper.cxx
  47. Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.30319.01 for 80x86
  48. Copyright (C) Microsoft Corporation. All rights reserved.
  49.  
  50. dt_wrapper.cxx
  51. link /dll /DEBUG /NOLOGO /out:dt_wrapper.dll /SUBSYSTEM:WINDOWS dt_wrapp
  52. er.obj /LIBPATH:"C:\Program Files (x86)\Data Translation\Win32\SDK"\Lib64 oldaap
  53. i64.lib OLMEM64.lib Graph64.lib
  54. Creating library dt_wrapper.lib and object dt_wrapper.exp
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement