layswan
8th October 2012, 04:51
Hi,

Anyone know how to call a DLL function in normal program script?

Below was the code that I used to call the DLL but i m getting value of 0 for func_id which mean function not found.

dll_id = load_dll("ocxswn1100")

message("%s", dll_id)

if dll_id then

func_id = get_function(dll_id, "cxwsn1100.whint.dlltdpur.get.buy.from.and.invoice.from.bp")

message("%s", func_id)

if func_id then

message("A")
endif
endif


Thanks!

vahdani
8th October 2012, 11:49
Hi,

two questions:


Is cxswn1100 really a DLL? By convention DLLs are named like cxswndll1100.
Is "cxwsn1100.whint.dlltdpur.get.buy.from.and.invoice.from.bp" an external function in cxswn1100 DLL?

bdittmar
8th October 2012, 11:54
Hi,

Anyone know how to call a DLL function in normal program script?

Below was the code that I used to call the DLL but i m getting value of 0 for func_id which mean function not found.

dll_id = load_dll("ocxswn1100")

message("%s", dll_id)

if dll_id then

func_id = get_function(dll_id, "cxwsn1100.whint.dlltdpur.get.buy.from.and.invoice.from.bp")

message("%s", func_id)

if func_id then

message("A")
endif
endif


Thanks!

Hello,

is #pragma .... used in declariation ?

#pragma used dll ocxwsn1100

and as vahdani suggest, is it realy a dll ?

Regards

vahdani
8th October 2012, 12:18
An After thought:

The functions load_dll(), get_function() and exec_function() are used when the DLL is not fixed or known at compile time. This is called Dynamic DLL loading. This technic is used for example in EDI where each EDI message type has its own processing DLL. Each DLL has then the same external function names with different function bodies/implementations.

If the DLL is known at compile time (as in 99% of programming cases) then you should do the following:

First make the DLL known to the compiler either by entering the DLL code in "libraries" in "Maintain scripts"-program or use pragma used dll in script like:

#pragma used dll otdslsdll1234

... and then in your script simply call an external function in the DLL such as:

ret.val = otdslsdll1234.some.function(param1, param2,..)