DLL Automatic Wrapper Generator
- Posted by bensler at mail.com
Feb 28, 2002
Hello all,
I've created a DLL Automatic Wrapper Generator.
You give it a link_list, and build a wrapper on the fly.
The generated wrapper can then be used without having to define the
link_list.
{"LoadIconA", {C_POINTER, C_INT}, C_INT} would allow you to call it like
this afterwards:
result = LoadIconA(a,i)
or if you want:
result = c_func(xLoadIconA,{a,i})
Here is a snippet from Window.exw that comes in the zip..
<CODE STARTS HERE>
include auto_wrap.e
-- After you've successfully generated your wrapper, and are satisfied
with it, you can
-- remove the DLL_link_list constant, and the call to build_wrapper()
constant DLL_link_list={
{"user32.dll",
{
{"LoadIconA", {C_POINTER, C_INT}, C_INT}, -- func
{"LoadCursorA", {C_POINTER, C_INT}, C_INT}, -- func
{"RegisterClassExA", {C_POINTER}, C_INT}, -- func
{"CreateWindowExA", -- func
{C_INT,
C_INT,C_INT,C_INT,C_INT,C_INT,C_INT,C_INT,C_INT,C_INT,C_INT,C_INT},
C_INT},
{"ShowWindow", {C_INT, C_INT}}, -- proc
{"UpdateWindow", {C_INT}}, -- proc
{"GetMessageA", {C_INT, C_INT, C_INT, C_INT}, C_INT}, -- func
{"TranslateMessage", {C_INT}}, -- proc
{"DispatchMessageA", {C_INT}}, -- proc
{"BeginPaint", {C_INT, C_POINTER}, C_INT}, -- func
{"GetClientRect", {C_INT, C_POINTER}}, -- proc
{"DrawTextA", {C_INT, C_INT, C_INT, C_INT, C_INT}}, -- proc
{"EndPaint", {C_INT, C_INT}}, -- proc
{"PostQuitMessage", {C_INT}}, -- proc
{"DefWindowProcA", {C_INT, C_INT, C_INT, C_INT}, C_INT} -- func
}
},
{"gdi32.dll",
{
{"GetStockObject", {C_INT}, C_INT} -- func
}
},
{"winmm.dll",
{
{"PlaySound", {C_INT, C_INT, C_INT}} -- proc
}
}
}
build_wrapper("win32_wrapper.e",DLL_link_list,1)
include win32_wrapper.e
<END OF CODE>
Let me know what you think. I would like to get some test results
before I give it to the archives.
Here is the link: http://third_eye13.tripod.com/dawg.html
Chris
|
Not Categorized, Please Help
|
|