Re: dynamic loading of dll's, ccall
----boundary-LibPST-iamunique-1303714230_-_-
Content-type: text/plain
Doug wrote:
> Looking back over the work I did at X-ray Instrumentation Associates I
> see that I called a non-CP generated dll. In this case the CP
> 'interface' file needed to specify the functions in the dll had to be
> tagged with the ccall flag.
For the current laser project I am calling a DLL supplied by National
Instruments. I used StdCall. This DLL was most likely created
with C, because all their examples use C. I also found by trial and
error that the DLL procedures need be called using a "normal" name
(e.g., imgSnap) rather than "decorated" name like _imgSnap{([at]})nowhere.xy
I am not sure how the DLL was created to avoid "decorated" names.
> When a dll is generated by CP and used by CP then the ccall flag is not
> needed (your code works from CP whether or not you specify ccall but I
> speculate that the parameters are left on the stack when you do. Try a
> long loop repeatly calling the procedure (without I/O) to see if you get
> a stack overflow).
I did not specify the [ccall] flag and the program is working.
I tested the result only a few times. I am hoping that this does not
mean that after a hundred calls the stack will overflow and the
machine will crash?
> When the dll is generated by CP but is expected to be used by non-CP
> languages that use the ccall convention then within the generating
> module one must use the ccall flag.
I am using StdCall, though the DLL was most likely created with C.
Wojtek
--------------------------------------------
To unsubscribe from this mailing list, send a message containing the word "unsubscribe" to:
blackbox-request{([at]})nowhere.xy
To get a list of valid e-mail commands and instructions on their usage, send a message containing the word "help" to the above address.
Send any problem reports or questions related to this email list to the list owner at
owner-blackbox{([at]})nowhere.xy
Current posting policy:
a) To post you should use the same address by which you are subscribed to the mailing list. That way, the list server will recognize you as subscriber and forward your posting immediately, without creating any overhead.
b) If, for some reason, you cannot post from the address, by which you are subscribed, your message will be moderated to avoid spam. Please understand that moderation will often cause some delay, in particular over weekends or holydays.
----boundary-LibPST-iamunique-1303714230_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"
e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcZnJvbXRleHQgXGRlZmYwe1xmb250dGJsDQp7XGYwXGZz
d2lzcyBBcmlhbDt9DQp7XGYxXGZtb2Rlcm4gQ291cmllciBOZXc7fQ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IHlvdSBhcmUgc3Vic2NyaWJlZCB0byB0aGUg
bWFpbGluZyBsaXN0LiBUaGF0IHdheSwgdGhlIGxpc3Qgc2VydmVyIHdpbGwgcmVjb2duaXplIHlv
dSBhcyBzdWJzY3JpYmVyIGFuZCBmb3J3YXJkIHlvdXIgcG9zdGluZyBpbW1lZGlhdGVseSwgd2l0
aG91dCBjcmVhdGluZyBhbnkgb3ZlcmhlYWQuXHBhcg0KXHBhcg0KYikgSWYsIGZvciBzb21lIHJl
YXNvbiwgeW91IGNhbm5vdCBwb3N0IGZyb20gdGhlIGFkZHJlc3MsIGJ5IHdoaWNoIHlvdSBhcmUg
c3Vic2NyaWJlZCwgeW91ciBtZXNzYWdlIHdpbGwgYmUgbW9kZXJhdGVkIHRvIGF2b2lkIHNwYW0u
IFBsZWFzZSB1bmRlcnN0YW5kIHRoYXQgbW9kZXJhdGlvbiB3aWxsIG9mdGVuIGNhdXNlIHNvbWUg
ZGVsYXksIGluIHBhcnRpY3VsYXIgb3ZlciB3ZWVrZW5kcyBvciBob2x5ZGF5fX0AICAgICAgICAg
IGJ5
----boundary-LibPST-iamunique-1303714230_-_---
Received on Thu Feb 12 2004 - 08:10:42 UTC
This archive was generated by hypermail 2.3.0
: Thu Sep 26 2013 - 06:28:54 UTC